Home > Software engineering >  MFC multithreading news communication
MFC multithreading news communication

Time:10-11

 m_pThread=AfxBeginThread (ReadFileThread, this); 

While (TRUE)
{
DWORD dResult;
MSG MSG.

DResult=MsgWaitForMultipleObjects (1, & amp; (m_pThread - & gt; M_hThread), FALSE, INFINITE, QS_ALLINPUT);

If (dResult==WAIT_OBJECT_0)//thread exit
break;
Else if (dResult==WAIT_OBJECT_0 + 1)//a message to
{
While (PeekMessage (& amp; MSG, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage (& amp; MSG);
DispatchMessage (& amp; MSG);
}
}
}

Thread creation is no problem, but while this section in the file is loaded in this thread will work and say in another message, I am a novice, ever know, put one code directly bai, thank you!!!!!

CodePudding user response:

Didn't understand you means is to pass the custom message sending yourself under the baidu

CodePudding user response:

reference 1st floor SWWLLX response:
didn't understand you means is to pass the custom message sending yourself under the baidu good

No, no, the only thread error in loading the data files, other place can be, may be another MsgWaitForMultipleObjects function, but I don't know ah,

CodePudding user response:

Or know about the "custom message",
To clear up your sources, create a message response

CodePudding user response:

What doesn't work? Compile but luck to have no effect or to run the exception?

CodePudding user response:

reference 4 floor lx624909677 response:
what doesn't work? Compile but luck to have no effect or to run the exception?

To set breakpoints, run has been in a while, and you won't come wireless loop

CodePudding user response:

Then see if (dResult==WAIT_OBJECT_0) this line, dResult value is certainly has been can't jump out of the loop

CodePudding user response:

refer to 6th floor lx624909677 response:
then see if (dResult==WAIT_OBJECT_0) this line, dResult values must be always can't jump out of the loop value
yes, but others program also can indeed, don't know how to modify
  • Related