IsDialogMessage Function

The IsDialogMessage function determines whether a message is intended for the specified dialog box and, if it is, processes the message.

Syntax

BOOL IsDialogMessage(      
    HWND hDlg,     LPMSG lpMsg );

Parameters

hDlg
[in] Handle to the dialog box.
lpMsg
[in] Pointer to an MSG structure that contains the message to be checked.

Return Value

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.

Windows 95/98/Me: IsDialogMessageW is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.

Function Information

Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systems Windows 95, Windows NT 3.1
UnicodeImplemented as ANSI and Unicode versions.

See Also

Tags :


Community Content

dmex
vb.net syntax
<DllImport("user32.dll", CharSet:=CharSet.Auto, ExactSpelling:=True)> _
Public Shared Function IsDialogMessage(ByVal hWndDlg As IntPtr, <[In], Out> ByRef msg As MSG) As Boolean
End Function
Tags :

dmex
C# syntax
[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern bool IsDialogMessage(IntPtr hWndDlg, [In, Out] ref MSG msg);
Tags :

Page view tracker