Hi,
Using CmtScheduleThreadPoolFunctionAdv() to spawn a thread, which is named DataService(). when it is spawning, I have specified the 8th parameter of the function, the callbackThreadID, it uses the CmtGetCurrentThreadID() to acquire. Due to the thread spawn function called is in the main function, so I think the "callbackThreadID" should be the main thread ID, which shoud be equal to get from CmtGetMainThreadID().
In the main function, I have a while loop which using GetUserEvent() to receive some user defined message. In the thread, the DataService() function, using PostDeferredCallToThread() to generate a callback function, the NotifyInfo() that calls the QueueUserEvent() to prepare some message. There is a problem not to be understanded, in the PostDeferredCallToThread(), if using CmtGetMainThreadID() as the 3rd parameter, the GetUserEvent() cannot received any message, but if using the callbackThreadID instead, everything is OK.
Please give an advise why it will hanppen such a mistake. Thanks.
David