共用方式為


CFrameWndEx Class

Implements the functionality of a Windows single document interface (SDI) overlapped or popup frame window, and provides members for managing the window. It extends the CFrameWnd class.

class CFrameWndEx : public CFrameWnd

Members

Public Methods

Name

Description

CFrameWndEx::ActiveItemRecalcLayout

Adjusts the layout of the OLE client item and the frame's client area.

CFrameWndEx::AddDockSite

This method is not used. 

CFrameWndEx::AddPane

Registers a control bar with the docking manager.

CFrameWndEx::AdjustDockingLayout

Recalculates the layout of all panes that are docked to the frame window.

CFrameWndEx::DelayUpdateFrameMenu

Sets the frame menu and then updates it when command processing is idle.

CFrameWndEx::DockPane

Docks the specified pane to the frame window.

CFrameWndEx::DockPaneLeftOf

Docks one pane to the left of another pane.

CFrameWndEx::EnableAutoHidePanes

Enables the auto-hide mode for the panes when they are docked to the specified sides of the main frame window.

CFrameWndEx::EnableDocking

Enables the docking of the panes that belong to the frame window.

CFrameWndEx::EnableFullScreenMainMenu

Shows or hides the main menu in a full screen mode.

CFrameWndEx::EnableFullScreenMode

Enables the full screen mode for the frame window.

CFrameWndEx::EnableLoadDockState

Enables or disables the loading of the docking state.

CFrameWndEx::EnablePaneMenu

Enables or disables the automatic handling of the pane menu.

CFrameWndEx::GetActivePopup

Returns a pointer to the currently displayed pop-up menu.

CFrameWndEx::GetDefaultResId

Returns the resource ID that you specified when the framework loaded the frame window.

CFrameWndEx::GetDockingManager

Retrieves the CDockingManager Class object for the frame window.

CFrameWndEx::GetMenuBar

Returns a pointer to the menu bar object attached to the frame window.

CFrameWndEx::GetPane

Returns a pointer to the pane that has the specified ID.

CFrameWndEx::GetRibbonBar

Retrieves the ribbon bar control for the frame.

CFrameWndEx::GetTearOffBars

Returns a list of pane objects that are in a tear-off state.

CFrameWndEx::GetToolbarButtonToolTipText

Called by the framework when the application displays the tooltip for a toolbar button.

CFrameWndEx::InsertPane

Registers a pane with the docking manager.

CFrameWndEx::IsFullScreen

Determines whether the frame window is in full screen mode.

CFrameWndEx::IsMenuBarAvailable

Determines whether the pointer to the menu bar object is valid.

CFrameWndEx::IsPointNearDockSite

Indicates whether the point is located in an alignment zone.

CFrameWndEx::IsPrintPreview

Indicates whether the frame window is in print preview mode.

CFrameWndEx::LoadFrame

This method is called after construction to create the frame window and load its resources.

CFrameWndEx::NegotiateBorderSpace

Implements OLE client border negotiation.

CFrameWndEx::OnActivate

The framework calls this method when user input is switched to or away from the frame.

CFrameWndEx::OnActivateApp

Called by the framework when the application is either selected or deselected.

CFrameWndEx::OnChangeVisualManager

Called by the framework when a change to the frame requires a change to the visual manager.

CFrameWndEx::OnClose

The framework calls this method to close the frame.

CFrameWndEx::OnCloseDockingPane

Called by the framework when the user clicks the Close button on a docking pane.

CFrameWndEx::OnCloseMiniFrame

Called by the framework when the user clicks the Close button on a floating mini frame window.

CFrameWndEx::OnClosePopupMenu

Called by the framework when an active pop-up menu processes a WM_DESTROY message.

CFrameWndEx::OnCmdMsg

Dispatches command messages.

CFrameWndEx::OnContextHelp

Called by the framework to display context related help.

CFrameWndEx::OnCreate

Called by the framework after the frame is created.

CFrameWndEx::OnDestroy

Called by the framework when the frame is destroyed.

CFrameWndEx::OnDrawMenuImage

Called by the framework when the application draws the image associated with a menu item.

CFrameWndEx::OnDrawMenuLogo

Called by the framework when a CMFCPopupMenu object processes a WM_PAINT message.

CFrameWndEx::OnDWMCompositionChanged

Called by the framework when Desktop Window Manager (DWM) composition has been enabled or disabled.

CFrameWndEx::OnExitSizeMove

Called by the framework when the frame stops moving or resizing.

CFrameWndEx::OnGetMinMaxInfo

Called by the framework when the frame is resized to set window dimension limits.

CFrameWndEx::OnIdleUpdateCmdUI

Called by the framework to update the frame display when command processing is idle.

CFrameWndEx::OnLButtonDown

The framework calls this method when the user presses the left mouse button.

CFrameWndEx::OnLButtonUp

The framework calls this method when the user releases the left mouse button.

CFrameWndEx::OnMenuButtonToolHitTest

Called by the framework when a CMFCToolBarButton object processes a WM_NCHITTEST message.

CFrameWndEx::OnMenuChar

Called by the framework when a menu is displayed and the user presses a key that does not correspond to a command.

CFrameWndEx::OnMouseMove

The framework calls this method when the pointer moves.

CFrameWndEx::OnMoveMiniFrame

Called by the framework when a pane window moves.

CFrameWndEx::OnNcActivate

Called by the framework when the non-client area of the frame must be redrawn to indicate a change in the active state.

CFrameWndEx::OnNcCalcSize

Called by the framework when the size and position of the client area must be calculated.

CFrameWndEx::OnNcHitTest

Called by the framework when the pointer moves or when a mouse button is pressed or released.

CFrameWndEx::OnNcMouseMove

Called by the framework when the pointer moves in a non-client area.

CFrameWndEx::OnNcPaint

Called by the framework when the non-client area must be painted.

CFrameWndEx::OnPaneCheck

Called by the framework to control the visibility of a pane.

CFrameWndEx::OnPostPreviewFrame

Called by the framework when the user has changed the print preview mode.

CFrameWndEx::OnPowerBroadcast

Called by the framework when a power management event occurs.

CFrameWndEx::OnSetMenu

Called by the framework to replace the frame window menu.

CFrameWndEx::OnSetPreviewMode

Called by the framework to set the print preview mode for the frame.

CFrameWndEx::OnSetText

Called by the framework to set the text of a window.

CFrameWndEx::OnShowCustomizePane

Called by the framework when a quick customize pane is enabled.

CFrameWndEx::OnShowPanes

Called by the framework to show or hide panes.

CFrameWndEx::OnShowPopupMenu

Called by the framework when a pop-up menu is enabled.

CFrameWndEx::OnSize

The framework calls this method after the frame's size changes.

CFrameWndEx::OnSizing

The framework calls this method when the user resizes the frame.

CFrameWndEx::OnSysColorChange

Called by the framework when the system colors change.

CFrameWndEx::OnTearOffMenu

Called by the framework when a menu that has a tear-off bar is enabled.

CFrameWndEx::OnToolbarContextMenu

Called by the framework to build a toolbar context menu.

CFrameWndEx::OnToolbarCreateNew

The framework calls this method to create a new toolbar.

CFrameWndEx::OnToolbarDelete

Called by the framework when a toolbar is deleted.

CFrameWndEx::OnUpdateFrameMenu

Called by the framework to set the frame menu.

CFrameWndEx::OnUpdateFrameTitle

The framework calls this method to update the title bar of the frame window.

CFrameWndEx::OnUpdatePaneMenu

Called by the framework to update the pane menu.

CFrameWndEx::OnWindowPosChanged

Called by the framework when the frame size, position, or z-order has changed because of a call to a window management method.

CFrameWndEx::PaneFromPoint

Returns the docking pane that contains the specified point.

CFrameWndEx::PreTranslateMessage

Handles specific window messages before they are dispatched.

CFrameWndEx::RecalcLayout

Adjusts the layout of the frame and its child windows.

CFrameWndEx::RemovePaneFromDockManager

Unregisters a pane and removes it from the internal list in the docking manager.

CFrameWndEx::SetDockState

Restores the docking layout to the docking state stored in the registry.

CFrameWndEx::SetPrintPreviewFrame

Sets the print preview frame window.

CFrameWndEx::SetupToolbarMenu

Inserts user-defined commands into a toolbar menu.

CFrameWndEx::ShowFullScreen

Switches the main frame between the full screen and the regular modes.

CFrameWndEx::ShowPane

Shows or hides the specified pane.

CFrameWndEx::UpdateCaption

Called by the framework to update the window frame caption.

CFrameWndEx::WinHelp

Invokes either the WinHelp application or context related help.

Example

The following example demonstrates how to inherit a class from the CFrameWndEx class. The example illustrates the method signatures in the subclass, and how to override the OnShowPopupMenu method. This code snippet is part of the Word Pad sample.

class CMainFrame : public CFrameWndEx
{
protected: // create from serialization only
    CMainFrame();
    DECLARE_DYNCREATE(CMainFrame)

// Attributes
public:
    HICON m_hIconDoc;
    HICON m_hIconText;
    HICON m_hIconWrite;
    HICON GetIcon(int nDocType);

// Operations
public:
    void UpdateMRUFilesList ()
    {
        m_wndTaskPane.UpdateMRUFilesList ();
    }

    void OnChangeLook ();

// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CMainFrame)
    public:
    virtual void ActivateFrame(int nCmdShow = -1);
    virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, CWnd* pParentWnd = NULL, CCreateContext* pContext = NULL);
    protected:
    virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
    virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
    //}}AFX_VIRTUAL

    virtual BOOL OnShowPopupMenu (CMFCPopupMenu* pMenuPopup);
    virtual BOOL OnTearOffMenu (CMFCPopupMenu* pMenuPopup, CPane* pBar);

protected:
    void AdjustObjectSubmenu (CMFCPopupMenu* pMenuPopup);
    void AdjustColorsMenu (CMFCPopupMenu* pMenuPopup, UINT uiId);

// Implementation
public:
    virtual ~CMainFrame();
#ifdef _DEBUG
    virtual void AssertValid() const;
    virtual void Dump(CDumpContext& dc) const;
#endif

public:
    CMFCMenuBar m_wndMenuBar;
    CMFCToolBar m_wndToolBar;
    CMFCStatusBar   m_wndStatusBar;
    CFormatBar      m_wndFormatBar;
    CRulerBar       m_wndRulerBar;
    CTaskPane       m_wndTaskPane;

protected:  // control bar embedded members
    BOOL CreateMenuBar();
    BOOL CreateToolBar();
    BOOL CreateFormatBar();
    BOOL CreateStatusBar();
    BOOL CreateRulerBar();
    BOOL CreateTaskPane ();

// Generated message map functions
protected:
    //{{AFX_MSG(CMainFrame)
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    afx_msg void OnSysColorChange();
    afx_msg void OnSize(UINT nType, int cx, int cy);
    afx_msg void OnMove(int x, int y);
    afx_msg void OnHelpFinder();
    afx_msg void OnDropFiles(HDROP hDropInfo);
    afx_msg void OnFontChange();
    afx_msg BOOL OnQueryNewPalette();
    afx_msg void OnPaletteChanged(CWnd* pFocusWnd);
    afx_msg void OnDevModeChange(LPTSTR lpDeviceName);
    afx_msg void OnViewCustomize();
    afx_msg void OnViewFullScreen();
    //}}AFX_MSG
    afx_msg LRESULT OnBarState(WPARAM wParam, LPARAM lParam);
    afx_msg LRESULT OnOpenMsg(WPARAM wParam, LPARAM lParam);
    afx_msg LRESULT OnHelpCustomizeToolbars(WPARAM wp, LPARAM lp);
    afx_msg LRESULT OnStartCustomize(WPARAM wp, LPARAM lp);
    afx_msg LRESULT OnToolbarCreateNew(WPARAM,LPARAM);
    afx_msg LRESULT OnGetDocumentColors(WPARAM,LPARAM);
    afx_msg void OnDummy();
    afx_msg void OnAskQuestion();
    DECLARE_MESSAGE_MAP()
};


...


BOOL CMainFrame::OnShowPopupMenu (CMFCPopupMenu* pMenuPopup)
{
    BOOL bRes = CFrameWndEx::OnShowPopupMenu (pMenuPopup);

    if (pMenuPopup != NULL && !pMenuPopup->IsCustomizePane())
    {
        AdjustObjectSubmenu (pMenuPopup);
        AdjustColorsMenu (pMenuPopup, ID_CHAR_COLOR);
    }

    return bRes;
}

Inheritance Hierarchy

CObject

   CCmdTarget

      CWnd

         CFrameWnd

            CFrameWndEx

Requirements

Header: afxframewndex.h

See Also

Reference

Hierarchy Chart

CFrameWnd

Other Resources

MFC Classes