LONG DefMDIChildProc(hWnd,wMsg,wParam,lParam)
This function provides default processing for any Windows messages that the window function of a multiple document interface (MDI) child window does not process. All window messages that are not explicitly processed by the window function must be passed to the DefMDIChildProc function, not the DefWindowProc function.
Parameter | Type/Description |
hWnd | HWND Identifies the MDI child window. | |
wMsg | WORD Specifies the message number. | |
wParam | WORD Specifies 16 bits of additional message-dependent information. | |
lParam | DWORD Specifies 32 bits of additional message-dependent information. |
The return value specifies the result of the message processing and depends on the actual message sent.
This function assumes that the parent of the window identified by the hWnd parameter was created with the MDICLIENT class.
Normally, 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 normally pass to DefWindowProc (such as nonclient messages and WM_SETTEXT) should be passed to DefMDIChildProc instead. In addition to these, DefMDIChildProc also handles the following messages:
Message | Default Processing by DefMDIChildProc |
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 key 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. |
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. |