Microsoft KB Archive/93916

= INFO: Calling MFC MDI Base Class Message Handlers =

Article ID: 93916

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft C/C++ Professional Development System 7.0

 Microsoft Visual C++ 1.0 Professional Edition

 Microsoft Visual C++ 1.5 Professional Edition

 Microsoft Visual C++ 1.51</li></ul>

 Microsoft Visual C++ 1.52 Professional Edition</li></ul>

 Microsoft Visual C++ 1.0 Professional Edition</li></ul>

 Microsoft Visual C++ 2.0 Professional Edition</li></ul>

 Microsoft Visual C++ 2.1</li></ul>

 Microsoft Visual C++ 2.2</li></ul>

 Microsoft Visual C++ 4.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q93916

<div class="notice_section">

<div class="summary_section">

SUMMARY
In an application developed for the Microsoft Windows environment that uses the multiple document interface (MDI), an application that implements an MDI frame window or an MDI child window must pass certain messages to the default window procedure to provide default MDI functionality. When the application uses the Microsoft C++ Foundation Classes (MFC), the application calls the base class message handler after processing an MDI message to provide the default MDI behavior.

<div class="moreinformation_section">

MORE INFORMATION
According to the Windows Software Development Kit (SDK) documentation for DefMDIChildProc, an application that uses MDI must pass messages to the appropriate function to provide default MDI behavior. In MFC, one of the message handling functions listed in the message map processes the MDI messages. If an application overrides the message handler for these messages, it may be necessary for the application to call the base class message handler after processing the message for MDI to function correctly.

The text below lists the messages processed by DefFrameProc and DefMDIChildProc, and the message handler that corresponds to each message:

Messages Processed by DefFrameProc
<pre class="fixed_text">  WM_COMMAND     OnCommand WM_MENUCHAR   OnMenuChar WM_SETFOCUS   OnSetFocus WM_SIZE       OnSize

Messages Processed by DefMDIChildProc
<pre class="fixed_text">  WM_CHILDACTIVATE    OnChildActivate WM_GETMINMAXINFO   OnGetMinMaxInfo WM_MENUCHAR        OnMenuChar WM_MOVE            OnSize WM_SETFOCUS        OnSetFocus WM_SIZE            OnSize WM_SYSCOMMAND      OnSysCommand If a class derived from CMDIFrameWnd overrides the OnCommand message handler, it must call the CMDIFrameWnd::OnCommand function for each message that it does not handle. Please refer to the Windows SDK documentation for more information about the messages processed by the DefFrameProc and DefMDIChildProc functions.

Keywords: kbinfo kbuidesign kbarchitecture kbdocview KB93916

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.