Compartilhar via


Posting Messages

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

To post a message, call the PostMessage function. PostMessage combines the message identifier and parameters into a single message and places it on the receiving window message queue. Eventually, the receiving window message loop removes the message from the message queue and dispatches it to the appropriate window procedure.

PostMessage(MyWindow, WM_COMMAND, MyWParam, MyLParam);

PostMessage is an asynchronous function. Windows Embedded CE does not synchronize between the sending thread and the receiving thread for posted messages. When the call to PostMessage returns, there is no guarantee that the window procedure for the receiving window has processed the message. In fact, if the message was posted to the same thread, the window procedure has not processed the message.

You can post a message without specifying a window. If you supply a NULL window handle when you call the PostMessage function, the message is posted to the queue that is associated with the current thread; because no window handle is specified, you must process the message directly from the message loop. This method of posting a message creates a message that applies to the entire application instead of a specific window.

See Also

Concepts

Working with Windows and Messages

Other Resources

GWES Application Development