BOOL IsDialogMessage(hwndDlg, lpmsg) | |||||
HWND hwndDlg; | /* handle of dialog box | */ | |||
LPMSG lpmsg; | /* address of structure with message | */ |
The IsDialogMessage function determines whether the specified message is intended for the given modeless dialog box and, if it is, processes the message.
hwndDlg
Identifies the dialog box.
lpmsg
Points to an MSG structure that contains the message to be checked. The MSG structure has the following form:
typedef struct tagMSG { /* msg */
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG;
The return value is TRUE if the message has been processed. Otherwise, it is FALSE.
Although IsDialogMessage is intended for modeless dialog boxes, it can be used with any window that contains controls, enabling such windows to provide the same keyboard selection as in a dialog box.
When IsDialogMessage processes a message, it checks for keyboard messages and converts them into selection commands 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.
If a message is processed by IsDialogMessage, it must not be passed to the TranslateMessage or DispatchMessage function. This is because IsDialogMessage performs all necessary translating and dispatching of messages.
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.
DispatchMessage, TranslateMessage