|
-
April 28th, 2010, 02:38 PM
#10
Re: How to manage user messege sent by PostThreadMessage
 Originally Posted by aragornx
Code:
BOOL CReaderThread::InitInstance() {
TRACE( _T("CReaderThread::InitInstance() START\r\n") );
if ( reader != NULL ) {
if ( start() == true ) {
mainLoop();
}
}
stop();
TRACE( _T("CReaderThread::InitInstance() STOP\r\n") );
AfxEndThread(0);
return TRUE;
}
The code in bold text is wrong. It is always wrong to do something extensive in InitInstance(). The purpose of InitiInstance) is initialization only, after which you should simply return TRUE so as to allow the built-in message loop to commence. Your code, on the other hand, traps the InitiInstance() function, by calling your mainLoop() function forever, and never allows InitInstance() to return. Thus, you block the built-in message loop from ever even starting.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|