Strange error returned by 'PostThreadMessage'...

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Nadav (anonymous_at_discussions.microsoft.com)
Date: 05/24/04


Date: Mon, 24 May 2004 15:31:05 -0700

Hi,

I have encountered a strange problem: while using PostThreadMessage to communicate between threads of different processes, PostThreadMessage returns "The message can be used only with synchronous operations" (1159), I didn't find any documentation discussing this error in details, does anyone has a clue??? What am I doing wrong here? Why should PostThreadMessage return this kind of error?

Following is the code used to post the message:
int iSendCnt = 10;
while(--iSendCnt > 0 && 0 == PostThreadMessage(dwDebuggerMsgThreadID, 1, 2300, 0))
   Sleep(0);

NOTE that the thread referred to by 'dwDebuggerMsgThreadID' has a
message pump: while(0 != GetMessage(&msg, NULL, 0, 0)) { ........ }

Thanks,
   Nadav