Export (0) Print
Expand All
7 out of 27 rated this helpful - Rate this topic

DispatchMessage function

Dispatches a message to a window procedure. It is typically used to dispatch a message retrieved by the GetMessage function.

Syntax


LRESULT WINAPI DispatchMessage(
  _In_  const MSG *lpmsg
);

Parameters

lpmsg [in]

Type: const MSG*

A pointer to a structure that contains the message.

Return value

Type:

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.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

Unicode and ANSI names

DispatchMessageW (Unicode) and DispatchMessageA (ANSI)

See also

Reference
GetMessage
IsDialogMessage
MSG
PeekMessage
TranslateMessage
WM_TIMER
Conceptual
Messages and Message Queues

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.