Dave's Brain

Browse - programming tips - win32 msg to thread

Date: 1997dec15
Platform: win32


Q. Up until now I was using Mutexs and Semaphores to communicate
with my thread.  But what if you want to queue some messages?

A. PostThreadMessage() ... I wish I'd known about it before
so I though I'd tell you about it. The thread needs to have a
PeekMessage() loop.

Here's what the manual says:

The PostThreadMessage function places (posts) a message in the message queue of the
specified thread and then returns without waiting for the thread to process the message. 

BOOL PostThreadMessage(
DWORD idThread, // thread identifier
UINT Msg, // message to post (nearly always WM_USER - dave)
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
); 
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Advertisements: