IsDialogMessage (Compact 2013)


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

BOOL IsDialogMessage( 
  HWND hDlg, 
  LPMSG lpMsg


[in] Handle to the dialog box.


[in] Long pointer to an MSG structure that contains the message to be checked.

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

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.

On Windows Embedded Compact, IsDialogMessage and the default WndProc for dialogs receive the topmost dialog window in the parent-child tree (usually the top-level window) from the HWND passed in as a parameter; this HWND is used as the root for keyboard navigation. However, this is not the behavior for the desktop, in which the HWND passed in is used as the root.

When the dwExStyle parameter of CreateWindowEx is set to WS_EX_CONTROLPARENT, IsDialogMessage receives the highest parent such that all nodes from this parent to the original HWND have the WS_EX_CONTROLPARENT flag and are recursable (visible and not disabled).

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.