The DispatchMessage function dispatches a message to a window procedure. It is typically used to dispatch a message retrieved by the GetMessage function.
Syntax
LRESULT DispatchMessage(
const MSG *lpmsg
);
Parameters
- lpmsg
-
[in] Pointer to an MSG structure that contains the message.
Return Value
The return value specifies the value returned by the window procedure. Although its meaning depends on the message being dispatched, the return value generally is ignored.
Remarks
The MSG structure must contain valid message values. If the lpmsg parameter points to a WM_TIMER message and the lParam parameter of the WM_TIMER message is not NULL, lParam points to a function that is called instead of the window procedure.
Note that the application is responsible for retrieving and dispatching input messages to the dialog box. Most applications use the main message loop for this. However, to permit the user to move to and to select controls by using the keyboard, the application must call IsDialogMessage. For more information, see Dialog Box Keyboard Interface.
Windows 95/98/Me: DispatchMessageW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.
Example
For an example, see Creating a Message Loop.
Function Information
| Minimum DLL Version | user32.dll |
|---|
| Header | Declared in Winuser.h, include Windows.h |
|---|
| Import library | User32.lib |
|---|
| Minimum operating systems |
Windows 95, Windows NT 3.1 |
|---|
| Unicode | Implemented as
ANSI and Unicode versions. |
|---|
See Also