Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2004

Tip: Looking for answers? Try searching our database.

Strange error returned by 'PostThreadMessage'...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nadav - 24 May 2004 23:31 GMT
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
William DePalo [MVP VC++] - 25 May 2004 01:12 GMT
> 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???

Well, the error text reads "this message". You are posting message #1,
WM_CREATE. Why the heck is that? :-)

Seriously, Windows itself sends (it does not post) WM_CREATE messages in
response to CreateWindow[Ex](). Now I have never tried to post a WM_CREATE
so I can't be sure but my guess is that Windows is doing some sanity checks.

You should use WM_USER, WM_APP or a registered message for private
communication if windows are involved or some other IPC technique if they
are not.

Regards,
Will

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.