An application can use the WinPostMsg function to post a message to a window. The message goes to the window's message queue. The following code fragment posts the WM_QUIT message.
HWND hwnd;
if (!WinPostMsg(hwnd, WM_QUIT, NULL, NULL)){
/* Message was not posted. */
}
The WinPostMsg function returns FALSE if the queue is full, and the message cannot be posted.