LRESULT DefMDIChildProc(hwnd, uMsg, wParam, lParam) | |||||
HWND hwnd; | /* handle of child window | */ | |||
UINT uMsg; | /* message | */ | |||
WPARAM wParam; | /* first message parameter | */ | |||
LPARAM lParam; | /* second message parameter | */ |
The DefMDIChildProc function provides default processing for any Windows messages that the window procedure of a multiple document interface (MDI) child window does not process. All window messages that are not explicitly processed by the window procedure must be passed to the DefMDIChildProc function, not the DefWindowProc function.
hwnd
Identifies the MDI child window.
uMsg
Specifies the message to be processed.
wParam
Specifies 16 bits of additional message-dependent information.
lParam
Specifies 32 bits of additional message-dependent information.
The return value specifies the result of the message processing and depends on the message sent.
This function assumes that the parent of the window identified by the hwnd parameter was created with the MDICLIENT class.
Typically, when an application's window procedure does not handle a message, it passes the message to the DefWindowProc function, which processes the message. MDI applications use the DefFrameProc and DefMDIChildProc functions instead of DefWindowProc to provide default message processing. All messages that an application would usually pass to DefWindowProc (such as nonclient messages and WM_SETTEXT) should be passed to DefMDIChildProc instead. In addition to handling these messages, DefMDIChildProc also handles the following messages:
Message | Response |
WM_CHILDACTIVATE | Performs activation processing when child windows are sized, moved, or shown. This message must be passed. |
WM_GETMINMAXINFO | Calculates the size of a maximized MDI child window based on the current size of the MDI client window. |
WM_MENUCHAR | Sends the keystrokes to the frame window. |
WM_MOVE | Recalculates MDI client scroll bars, if they are present. |
WM_SETFOCUS | Activates the child window if it is not the active MDI child window. |
WM_SIZE | Performs necessary operations when changing the size of a window, especially when maximizing or restoring an MDI child window. Failing to pass this message to DefMDIChildProc will produce highly undesirable results. |
WM_SYSCOMMAND | Also handles the next window command. |