共用方式為


IsDialogMessage

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This 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] Long pointer to an MSG structure that contains the message to be checked.

Return Value

Nonzero indicates that the message has been processed. Zero indicates that the message has not been processed.

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.

If a custom, application-defined dialog window is used with this function, its class name must be DIALOG. Or, its class must be registered with the cbWndExtra member of the WNDCLASS structure set to a value equal to or greater than the cbWndExtra value obtained by a call to the GetClassInfo function on the system DIALOG class.

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.

Requirements

Header winuser.h
Library Dlgmgr.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

DispatchMessage
TranslateMessage
DM_GETDEFID
DM_SETDEFID
WM_GETDLGCODE
WM_USER
MSG
WNDCLASS
Dialog Boxes Functions