DispatchMessageW function (winuser.h)
Dispatches a message to a window procedure. It is typically used to dispatch a message retrieved by the GetMessage function.
Syntax
LRESULT DispatchMessageW(
[in] const MSG *lpMsg
);
Parameters
[in] lpMsg
Type: const MSG*
A pointer to a structure that contains the message.
Return value
Type: LRESULT
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.
Examples
For an example, see Creating a Message Loop.
Note
The winuser.h header defines DispatchMessage as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | winuser.h (include Windows.h) |
Library | User32.lib |
DLL | User32.dll |
API set | ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows 8) |
See also
Conceptual
Reference