IsDialogMessageA function (winuser.h)

Determines whether a message is intended for the specified dialog box and, if it is, processes the message.

Syntax

BOOL IsDialogMessageA(
  [in] HWND  hDlg,
  [in] LPMSG lpMsg
);

Parameters

[in] hDlg

Type: HWND

A handle to the dialog box.

[in] lpMsg

Type: LPMSG

A pointer to an MSG structure that contains the message to be checked.

Return value

Type: BOOL

If the message has been processed, the return value is nonzero.

If the message has not been processed, the return value is zero.

Remarks

Although the IsDialogMessage function is intended for modeless dialog boxes, you can use it with any window that contains controls, enabling the windows to provide the same keyboard selection as is used in a dialog box.

When IsDialogMessage processes a message, it checks for keyboard messages and converts them into selections for the corresponding dialog box. For example, the TAB key, when pressed, selects the next control or group of controls, and the DOWN ARROW key, when pressed, selects the next control in a group.

Because the IsDialogMessage function performs all necessary translating and dispatching of messages, a message processed by IsDialogMessage must not be passed to the TranslateMessage or DispatchMessage function.

IsDialogMessage sends WM_GETDLGCODE messages to the dialog box procedure to determine which keys should be processed.

IsDialogMessage can send DM_GETDEFID and DM_SETDEFID messages to the window. These messages are defined in the Winuser.h header file as WM_USER and WM_USER + 1, so conflicts are possible with application-defined messages having the same values.

Note

The winuser.h header defines IsDialogMessage as an alias which 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 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-dialogbox-l1-1-3 (introduced in Windows 10, version 10.0.14393)

See also

Conceptual

DM_GETDEFID

DM_SETDEFID

Dialog Boxes

DispatchMessage

MSG

Reference

TranslateMessage

WM_GETDLGCODE

WM_USER