开发者

PostThreadMessage fails

I have created a UI thread. I m posting message to the UI thread which will write data in a file.

I am using PostThreadMessage API to post the message to User thread. My Problem is it's not writing all the data that I have posted. For Instance, if i post 100 data, it writes randomly 3 or 98 varies for every execution. The handler for Postdata is not getting called for every message.

CWriteToFile *m_pThread = (CWriteToFile *)Af开发者_如何学CxBeginThread(RUNTIME_CLASS (CWriteToFile));

PostThreadMessage(m_pThread->m_nThreadID , WM_WRITE_TO_FILE, (WPARAM)pData,NULL);

WaitForSingleObject(m_pThread, INFINITE);   

The Return value of PostThreadMessage is success.


The PostMessage family of functions can fail if the message queue is full. You should check whether or not the function call succeeds.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜