I created a thread using CreateThread,that I can get the ID of the thread.
I want to terminate the thread now.
I know I can use terminatethread to end it.
But it says that using that way is not a good method.
And I try to use PostThreadMessage(threadID,WM_QUIT,0,0),but the thread would not end!
Someone would like to tell me how to end the thread except using terminatethread?(And I did not use CWinThread).Thanks.
Use the technique described in Newcomer's article: wait for some handles to synchronization objects with a call to ::WaitForMultipleObjects() where one of them (preferably the first one for priority reasons) is signaled when the thread should terminate.
After you have set this event you should wait on the thread handle with ::WaitForSingleObject() to know when the thread has finished completely to be able to clean up the trhead object and other resources you have claimed for the thread.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
This won't work in my situation since I'm not actually reading a file but a pipe. I'm diverting the putput of a console, so the bytes being read could either be ascii or unicode, but I have yet to find an easy way to determine which.
I have a owner-draw dialog,I change its default color to blue.But when the dialog was minimized,there would be a thin rectange left on the screen.
Someone would like to tell me why and how to resolve it?