|
|
Your sig is looking a lot better ;0)
|
|
|
|
|
Thanks
|
|
|
|
|
Ok guys, i solved the problem using the processes HANDLE and PROCESS_INFORMATION
<br />
PROCESS_INFORMATION piProcessA;<br />
...<br />
DWORD dwExitCode;<br />
GetExitCodeProcess(piProcessA, &dwExitCode);<br />
while (dwExitCode == STILL_ACTIVE)<br />
{<br />
GetExitCodeProcess(process, &dwExitCode);<br />
Sleep(500);<br />
}<br />
Next challenge: How could it be done to have dynamic process dependencies. The configuration should be made in a header file (f.e. via #define)
There are a few processes: A,B,C and D
B depends on A and C --> #define B_DEPS "A,C"
Any ideas?
Ciao, nmx
|
|
|
|
|
Hi,
I want minimize,maximize,close icon in child window.How can i do this?
I tried lot of things but failed.
The problem is..I got these icons in my child window, when i minimized it has gone somewhere, so i cudn't maximize the window again..and also when i click restoreup in that three icon(middle one) it didn't minimized to small size..nothing get changed but three icons will disappeared.
One morething these three icons didnot display when the application opens, when i switch to another window in the same application then come back to this window then the three icons appear,
What can i do?
My requiremnt is same as vc++ coding environment(i.e., we can minimize,close and maximize the text editor in our vc++ complier)I need the same functionality..Pls help me out?
Anu
|
|
|
|
|
hi all i had made application that send() recv() through winsock API's not the MFC classes and winsock controll.
when i send one time it works fine and receives well but when i send more than once at a time
i.e
if((send(conn,"11",strlen("13"),0))==2)<br />
AfxMessageBox("11");<br />
if((send(conn,"12",strlen("13"),0))==2)<br />
AfxMessageBox("11");<br />
if((send(conn,"13",strlen("13"),0))==2)<br />
AfxMessageBox("13");<br />
and then closing the sockets<br />
other side cannot receive anything i mean it receive 0 bytes.i m using the receive side in for loop here is the code.
for (int i=0;i<3;i++)<br />
{<br />
int numbytes;<br />
char buf[5];<br />
if((numbytes=recv(new_fd,buf,strlen(buf),0))==0)<br />
AfxMessageBox("Conn Forcefully Rejected Receive Error");<br />
else<br />
{<br />
buf[(numbytes+1)] = '\0';<br />
AfxMessageBox(buf);<br />
} <br />
} and then it closes sockets also.
but it shows the conn forefully rejected receive error.
i dont why it is this.
Tasleem Arif
|
|
|
|
|
you just mention length '2'.
recv(new_fd,buf,strlen(buf),0)
instead use this
recv(new_fd,buf,2,0)
|
|
|
|
|
thanks it did worked.
Tasleem Arif
|
|
|
|
|
It seems that you find your answer but see an article about transfer file with socket on codeproject maybe it helpful for you.
|
|
|
|
|
In my opinion there could be many reasons for this code not working. The most important and in my opinion the one with the brightest chances is the connection not properly set up. post the full code then may be anybody would be able to help!
Unless lions have their historians, the tales of hunt will always glorify the hunters!
|
|
|
|
|
here is code for client that connected to server
WORD wVersionRequested;<br />
WSADATA wsaData;<br />
SOCKET conn;<br />
struct sockaddr_in server;<br />
<br />
wVersionRequested = MAKEWORD(2,0);<br />
if(WSAStartup( wVersionRequested, &wsaData)==0)<br />
{<br />
conn=socket(AF_INET,SOCK_STREAM,0);<br />
if(conn==INVALID_SOCKET)<br />
AfxMessageBox("Socket Created Fails");<br />
bool urlog=false; bool chatlog=false;<br />
bool blknet=false;bool blkusb=false;<br />
bool scrcap=false;<br />
<br />
CISFControllerDlg *obj=(CISFControllerDlg*)parame;<br />
server.sin_addr.s_addr=inet_addr((char*)(LPCTSTR)obj->m_strIp);<br />
server.sin_family=AF_INET;<br />
server.sin_port=htons(8085);<br />
if(connect(conn,(struct sockaddr*)&server,sizeof(server))==0)<br />
{<br />
HWND hCbox= GetDlgItem(obj->m_hWnd,IDC_CHKLOGURL);<br />
if(SendMessage(hCbox,BM_GETCHECK,0,0)==BST_CHECKED)<br />
{<br />
send(conn,"11",strlen("11"),0);<br />
AfxMessageBox("11");<br />
urlog=true;<br />
}<br />
else<br />
{<br />
send(conn,"12",strlen("12"),0);<br />
}<br />
hCbox= GetDlgItem(obj->m_hWnd,IDC_CHKLOGCHAT);<br />
if(SendMessage(hCbox,BM_GETCHECK,0,0)==BST_CHECKED)<br />
{<br />
send(conn,"21",strlen("21"),0);<br />
chatlog=true;<br />
}<br />
else<br />
{<br />
send(conn,"22",strlen("22"),0);<br />
}<br />
hCbox= GetDlgItem(obj->m_hWnd,IDC_CHKBLKNTWK);<br />
if(SendMessage(hCbox,BM_GETCHECK,0,0)==BST_CHECKED)<br />
{<br />
send(conn,"31",strlen("31"),0);<br />
blknet=true;<br />
}<br />
else<br />
{<br />
send(conn,"32",strlen("32"),0);<br />
}<br />
hCbox= GetDlgItem(obj->m_hWnd,IDC_CHKSRCCAP);<br />
if(SendMessage(hCbox,BM_GETCHECK,0,0)==BST_CHECKED)<br />
{<br />
send(conn,"41",strlen("41"),0);<br />
obj->m_SleepTime.TrimLeft();<br />
obj->m_SleepTime.TrimRight();<br />
t=(char*)(LPCTSTR)obj->m_SleepTime;<br />
send(conn,t,strlen(t),0);<br />
ShowWindow(GetDlgItem(obj->m_hWnd,IDC_EDSCTIME),false);<br />
ShowWindow(GetDlgItem(obj->m_hWnd,IDC_STATICTIME),false);<br />
scrcap=true;<br />
}<br />
else<br />
{<br />
send(conn,"42",strlen("42"),0);<br />
}<br />
hCbox= GetDlgItem(obj->m_hWnd,IDC_CHKUSB);<br />
if(SendMessage(hCbox,BM_GETCHECK,0,0)==BST_CHECKED)<br />
{<br />
send(conn,"51",strlen("51"),0);<br />
blkusb=true;<br />
}<br />
else<br />
{<br />
send(conn,"52",strlen("52"),0);<br />
}<br />
obj->m_LLobj.UpdateLinkList(obj->m_strIp,urlog,chatlog,blkusb,blknet,scrcap);<br />
}<br />
else<br />
AfxMessageBox("Connect Fails");<br />
closesocket(conn);<br />
shutdown(conn,2);<br />
}<br />
else<br />
AfxMessageBox("Start UP Fails");<br />
WSACleanup();<br />
return 0;<br />
}
here is the server portion both r in seperate thread.
WORD wVersionRequested;<br />
WSADATA wsaData;<br />
wVersionRequested = MAKEWORD(2,0);<br />
if(WSAStartup( wVersionRequested, &wsaData) == 0 )<br />
{<br />
while(bRunService)<br />
{<br />
int sockfd, new_fd;
struct sockaddr_in my_addr;
struct sockaddr_in their_addr;
int sin_size;<br />
char *yes="1";<br />
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) <br />
AfxMessageBox("Socket Creation Failed");<br />
if (setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR,yes,sizeof(yes)) == -1) <br />
AfxMessageBox("set socket app");<br />
my_addr.sin_family = AF_INET;
my_addr.sin_port = htons(8085);
my_addr.sin_addr.s_addr =INADDR_ANY;
memset(&(my_addr.sin_zero), '\0', 8);
<br />
if(bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr))== -1) <br />
AfxMessageBox("IP not binded");<br />
<br />
if (listen(sockfd, 5) == -1) <br />
AfxMessageBox("Listen Failed");<br />
<br />
sin_size = sizeof(struct sockaddr_in);<br />
if ((new_fd = accept(sockfd, (struct sockaddr *)&their_addr,&sin_size)) == -1)<br />
AfxMessageBox("accept failed");
<br />
AfxMessageBox("Accept");<br />
for (int i=0;i<4;i++){<br />
int numbytes;<br />
char buf[5];<br />
if((numbytes=recv(new_fd,buf,2,0))==0)<br />
AfxMessageBox("Conn Forcefully Rejected Receive Error");<br />
else<br />
{<br />
buf[(numbytes+1)] = '\0';<br />
AfxMessageBox(buf);<br />
int choice=atoi(buf);<br />
switch(choice)<br />
{<br />
case 11:
if(!bLogUrl)<br />
{<br />
bLogUrl=TRUE;<br />
RegisterBHO();<br />
}<br />
break;<br />
case 12:<br />
if(bLogUrl)<br />
{<br />
bLogUrl=FALSE;<br />
UnregisterBHO();<br />
}<br />
break;<br />
case 21:
if (!bLogChat) <br />
{<br />
bLogChat=TRUE;<br />
StartKeyloggerThread();<br />
}<br />
break;<br />
case 22:<br />
bLogChat=FALSE;<br />
break;<br />
case 31:
if (!bAddFilters)<br />
{<br />
bAddFilters=TRUE;<br />
AddSingleFilter();<br />
}<br />
break;<br />
case 32:
if (bAddFilters)<br />
{<br />
bAddFilters=FALSE;<br />
RemoveSingleFilter();<br />
}<br />
break;<br />
case 41:
if (!bScreenCap)<br />
{<br />
char temp[5];<br />
numbytes=recv(new_fd,temp,strlen(buf),0);<br />
bScreenCap=TRUE;<br />
temp[numbytes+1]='\0';<br />
AfxMessageBox(temp);<br />
SleepTime=atoi(temp);<br />
StartScreenCapThread();<br />
}<br />
break;<br />
case 42:<br />
bScreenCap=FALSE;<br />
break;<br />
case 51:
AfxMessageBox("51");<br />
break;<br />
case 52:<br />
AfxMessageBox("52");<br />
break;<br />
}}
}
closesocket(new_fd);<br />
closesocket(sockfd);<br />
shutdown(sockfd,2);<br />
shutdown(new_fd,2);<br />
}
}<br />
WSACleanup();<br />
return 0;
its too long but it is it.
Tasleem Arif
|
|
|
|
|
Hello friends,
I have an appication of recording a wave file.
But i want to specify the sound device through which only
the wave file should be recorded. That is if my machine has more than one sound card
then i want to select one (through Programmatically) and record sound from that one only.
How to do that.
Thanks in Advance.
Rahul Kulkarni
|
|
|
|
|
I am amidst developement of toolbar for a site on IE.
buttons have been added to it with help of TB_Insert.
I have to get now coordinate position of each button.
How to get the position. Can anyone help me. Only ATL no MFC.
|| ART OF LIVING ||
|
|
|
|
|
Sir,
Is there any difference between hardware interfacing and embedding systems.
Thanks
|
|
|
|
|
Hi,
I get the file size and I want to format it using the format (xxx,xxx,xxx), for example:
35456931 --> 35,456,931 bytes.
how can I do it??
Regards
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Mohammad A Gdeisat wrote:
35456931 --> 35,456,931 bytes.
Like this:
CString strNum="123467890";
int len=strNum.GetLength ();
for(int i=len-3;i>0;i-=3)
{
strNum.Insert (i,',');
}
AfxMessageBox (strNum);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Here is some code that will format a number using the current locale settings:
std::string format(unsigned int n)
{
std::stringstream strm;
strm.imbue(std::locale(""));
strm << n;
return strm.str();
}
Kicking squealing Gucci little piggy.
|
|
|
|
|
This version should handle any number (int, long, etc.):
template <typename T>
std::string format(T t)
{
std::stringstream strm;
strm.imbue(std::locale(""));
strm << t;
return strm.str();
}
Last modified: 11mins after originally posted --
Kicking squealing Gucci little piggy.
|
|
|
|
|
|
Exactly how does this add commas to the number?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I see he gets file size so I guess its better he uses from this function (for comma CString::Format )
|
|
|
|
|
Use GetNumberFormat() to format a number with commas (or whatever you use in your locale).
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I am using Visual studio 2005 (VC.Net). I am getting a very strange error in my application when i am calling managed code function ie. When I am loading XML file through load function with System::XML::XmlDataDocument object variable. The error message is
Managed Debugging Assistant 'FatalExecutionEngineError' has detected a problem in 'C:\TestApp.exe'.
Additional Information: The runtime has encountered a fatal error. The address of the error was at 0x79f9432a, on thread 0x3d4. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
Please kindly help me.
Regards,
KN Rao
knarasimharao
|
|
|
|
|
It seems its Managed C++,right?
|
|
|
|
|
yes it's a managed C++
knarasimharao
|
|
|
|
|