BOOL PostMessage(hWnd,wMsg,wParam,lParam)
This function places a message in a window's application queue, and then returns without waiting for the corresponding window to process the message. The posted message can be retrieved by calls to the GetMessage or PeekMessage function.
Parameter | Type/Description |
hWnd | HWND Identifies the window to receive the message. If the hWnd parameter is 0xFFFF, the message is sent to all overlapped or pop-up windows in the system. The message is not sent to child windows. | |
wMsg | WORD Specifies the type of message posted. | |
wParam | WORD Specifies additional message information. | |
lParam | DWORD Specifies additional message information. |
The return value specifies whether or not the message is posted. It is nonzero if the message is posted. Otherwise, it is zero.
An application should never use the PostMessage function to send a message to a control. If a system running Windows is configured for an expanded-memory system (EMS) and an application sends a message (by using the PostMessage function) with related data (that are pointed to by the lParam parameter) to a second application, the first application must place the data (that lParam points to) in global memory allocated with the Global-Alloc function and the GMEM_LOWER flag. Note that this allocation of memory is necessary only if lParam contains a pointer.
Unlike other Windows functions, an application may call PostMessage at the hardware-interrupt level.