DefFrameProc

  LRESULT DefFrameProc(hwnd, hwndMDIClient, uMsg, wParam, lParam)    
  HWND hwnd; /* handle of frame window */
  HWND hwndMDIClient; /* handle of client window */
  UINT uMsg; /* message */
  WPARAM wParam; /* first message parameter */
  LPARAM lParam; /* second message parameter */

The DefFrameProc function provides default processing for any Windows messages that the window procedure of a multiple document interface (MDI) frame window does not process. All window messages that are not explicitly processed by the window procedure must be passed to the DefFrameProc function, not the DefWindowProc function.

Parameters

hwnd

Identifies the MDI frame window.

hwndMDIClient

Identifies the MDI client window.

uMsg

Specifies the message to be processed.

wParam

Specifies additional message-dependent information.

lParam

Specifies additional message-dependent information.

Return Value

The return value specifies the result of the message processing and depends on the actual message sent. If the hwndMDIClient parameter is NULL, the return value is the same as for the DefWindowProc function.

Comments

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 DefFrameProc instead. In addition to handling these messages, DefFrameProc also handles the following messages:

Message Response

WM_COMMAND The frame window of an MDI application receives the WM_COMMAND message to activate a particular MDI child window. The window identifier accompanying this message will identify the MDI child window assigned by Windows, starting with the first identifier specified by the application when it created the MDI client window. This value of the first identifier must not conflict with menu-item identifiers.
WM_MENUCHAR When the user presses the ALT+- key combination, the System menu (often called Control menu) of the active MDI child window will be selected.
WM_SETFOCUS DefFrameProc passes focus on to the MDI client, which in turn passes the focus on to the active MDI child window.
WM_SIZE If the frame window procedure passes this message to DefFrameProc, the MDI client window will be resized to fit in the new client area. If the frame window procedure sizes the MDI client to a different size, it should not pass the message to DefWindowProc.

See Also

DefHookProc, DefMDIChildProc, DefWindowProc