PostMessage

2.x

  BOOL PostMessage(hwnd, uMsg, wParam, lParam)    
  HWND hwnd; /* handle of the destination window */
  UINT uMsg; /* message to post, */  
  WPARAM wParam; /* first message parameter */
  LPARAM lParam; /* second message parameter */

The PostMessage function posts (places) a message in a window's message queue and then returns without waiting for the corresponding window to process the message. Messages in a message queue are retrieved by calls to the GetMessage or PeekMessage function.

hwnd

Identifies the window to which the message will be posted. If this parameter is HWND_BROADCAST, the message will be posted to all top-level windows, including disabled or invisible unowned windows.

uMsg

Specifies the message to be posted.

wParam

Specifies 16 bits of additional message-dependent information.

lParam

Specifies 32 bits of additional message-dependent information.

Return Value

The return value is nonzero if the function is successful. Otherwise, it is zero.

Comments

An application should never use the PostMessage function to post a message to a control.

If the message is being posted to another application and the wParam or lParam parameter is used to pass a handle or pointer to a global memory object, the memory should be allocated by the GlobalAlloc function, using the GMEM_SHARE flag.

See Also

GetMessage, PeekMessage, PostAppMessage, SendDlgItemMessage, SendMessage