PostMessage

The PostMessage function places (posts) a message in the message queue associated with the thread that created the specified window and then returns without waiting for the thread to process the message.

dword PostMessage(
  dword hWnd,      // handle of destination window
  dword Msg,       // message to post
  dword wParam,  // first message parameter
  dword lParam   // second message parameter
);
 

Parameters

hWnd
Handle to the window whose window procedure is to receive the message.
Msg
Specifies the message to be posted.
Value Meaning
WM_COMMAND The message is used to simulate the user selects a command item from a menu.
wParam
Specifies additional message-specific information. See Application Messages.
lParam
Specifies additional message-specific information.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.


Example

wnd.PostMessage(GetMainWnd(), WM_COMMAND, IDM_OPEN_FILE, NULL )