The information in this article applies to:
SUMMARY
In a Microsoft Foundation Classes (MFC) application, you can attach control
bars such as status bars and toolbars to a frame window. However, for many
applications a simple dialog-based user interface is sufficient. MFC does
not provide built-in support for adding control bars to dialogs.
http://www.microsoft.com/downloads/search.aspand then click How to use the Microsoft Download Center. For additional information on Visual C++ versions 4.0 and greater, please see the following article in the Microsoft Knowledge Base: Q141751 Adding Control Bars to Dialog Boxes in MFC MORE INFORMATION
To add a control bar to a dialog, you must create the control bar as
usual, and then make room for the control bar within the client area of
the dialog. For the control bar to function properly, the dialog must
duplicate some of the functionality of frame windows. If you want
ON_UPDATE_COMMAND_UI handlers to work for the control bars, you also need
to derive new control bar classes, and handle the WM_IDLEUPDATECMDUI
message. If your dialog is not the main window of your application, you
will also need to modify its parent frame window to pass the
WM_IDLEUPDATECMDUI message on to the dialog's control bars.
To allow ON_UPDATE_COMMAND_UI handlers to work for other status bar panes and for toolbar buttons, you must derive new control bar classes and implement a message handler for WM_IDLEUPDATECMDUI. This is necessary because the default control bar implementations of OnUpdateCmdUI() assume the parent window is a frame window. However, it doesn't do anything but pass the parent window pointer on to a function which only requires a CCmdTarget pointer. Therefore, you can temporarily tell OnUpdateCmdUI() that the parent window pointer you are giving it is a CFrameWnd pointer to meet the compiler requirements. Here's an example:
To pass WM_IDLEUPDATECMDUI messages on to dialogs other than the main
window, save dialog pointers in your frame window class and create a
WM_IDLEUPDATECMDUI handler in that class. The handler should send the
WM_IDLEUPDATECMDUI message on to the dialog child windows by using
CWnd::SendMessageToDescendants(). Then perform default processing for the
message within the frame window.
Additional query words: CDialog CStatusBar CToolBar
Keywords : kbfile kbprg kbsample kbMFC KbUIDesign kbVC kbfaq |
Last Reviewed: January 12, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |