COleIPFrameWndEx Class

The COleIPFrameWndEx class implements an OLE container that supports MFC. You must derive the in-place frame window class for your application from the COleIPFrameWndEx class, instead of deriving it from the COleIPFrameWndclass. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

Syntax

class COleIPFrameWndEx : public COleIPFrameWnd

Members

Public Methods

Name Description
COleIPFrameWndEx::AddDockSite
COleIPFrameWndEx::AddPane
COleIPFrameWndEx::AdjustDockingLayout
COleIPFrameWndEx::DockPane
COleIPFrameWndEx::DockPaneLeftOf Docks one pane to the left of another pane.
COleIPFrameWndEx::EnableAutoHidePanes
COleIPFrameWndEx::EnableDocking
COleIPFrameWndEx::EnablePaneMenu
COleIPFrameWndEx::GetActivePopup Returns a pointer to the currently displayed popup menu.
COleIPFrameWndEx::GetContainerFrameWindow
COleIPFrameWndEx::GetDefaultResId Returns the resource ID of the frame window that you specified when the window was loaded.
COleIPFrameWndEx::GetDockFrame
COleIPFrameWndEx::GetDockingManager
COleIPFrameWndEx::GetMainFrame
COleIPFrameWndEx::GetMenuBar Returns a pointer to the menu bar object attached to the frame window.
COleIPFrameWndEx::GetPane
COleIPFrameWndEx::GetTearOffBars Returns a list of pane objects that are in a tear-off state.
COleIPFrameWndEx::GetToolbarButtonToolTipText Called by the framework before the tooltip for a button is displayed.
COleIPFrameWndEx::InsertPane
COleIPFrameWndEx::IsMenuBarAvailable Determines whether the pointer to the menu bar object is not NULL.
COleIPFrameWndEx::IsPointNearDockSite
COleIPFrameWndEx::LoadFrame (Overrides COleIPFrameWnd::LoadFrame.)
COleIPFrameWndEx::OnCloseDockingPane
COleIPFrameWndEx::OnCloseMiniFrame
COleIPFrameWndEx::OnClosePopupMenu Called by the framework when an active pop-up menu processes a WM_DESTROY message.
COleIPFrameWndEx::OnCmdMsg (Overrides CFrameWnd::OnCmdMsg.)
COleIPFrameWndEx::OnDrawMenuImage Called by the framework when the image associated with a menu item is drawn.
COleIPFrameWndEx::OnDrawMenuLogo Called by the framework when a CMFCPopupMenuobject processes a WM_PAINT message.
COleIPFrameWndEx::OnMenuButtonToolHitTest Called by the framework when a CMFCToolBarButtonobject processes WM_NCHITTEST message.
COleIPFrameWndEx::OnMoveMiniFrame
COleIPFrameWndEx::OnSetPreviewMode Call this member function to set the application's main frame window into and out of print-preview mode. (Overrides CFrameWnd::OnSetPreviewMode.)
COleIPFrameWndEx::OnShowCustomizePane
COleIPFrameWndEx::OnShowPanes
COleIPFrameWndEx::OnShowPopupMenu Called by the framework when a pop-up menu is activated.
COleIPFrameWndEx::OnTearOffMenu Called by the framework when a menu that has a tear-off bar is activated.
COleIPFrameWndEx::PaneFromPoint
COleIPFrameWndEx::PreTranslateMessage (Overrides COleIPFrameWnd::PreTranslateMessage.)
COleIPFrameWndEx::RecalcLayout (Overrides COleIPFrameWnd::RecalcLayout.)
COleIPFrameWndEx::RemovePaneFromDockManager
COleIPFrameWndEx::SetDockState Applies the specified docking state to the panes that belong to the frame window.
COleIPFrameWndEx::SetupToolbarMenu Modifies a toolbar object by searching for dummy items and replacing them with the specified user-defined items.
COleIPFrameWndEx::ShowPane
COleIPFrameWndEx::WinHelpA Called by the framework to initiate the WinHelp application or context help.

Protected Methods

Name Description
COleIPFrameWndEx::InitUserToobars Tells the framework to initialize a range of control IDs that are assigned to user-defined toolbars.

Example

The following example demonstrates how to subclass an instance of the COleIPFrameWndEx class and over ride its methods. The example shows how to over ride the OnDestory method, the RepositionFrame method, the RecalcLayout method, and the CalcWindowRect method. This code snippet is part of the Word Pad sample.

void CInPlaceFrame::OnDestroy()
{
   m_wndToolBar.DestroyWindow();
   m_wndFormatBar.DestroyWindow();
   COleIPFrameWndEx::OnDestroy();
}

void CInPlaceFrame::RepositionFrame(LPCRECT lpPosRect, LPCRECT lpClipRect)
{
   CRect rectNew = lpPosRect;
   rectNew.left -= HORZ_TEXTOFFSET;
   rectNew.top -= VERT_TEXTOFFSET;
   m_wndResizeBar.BringWindowToTop();
   COleIPFrameWndEx::RepositionFrame(&rectNew, lpClipRect);
   CWnd *pWnd = GetActiveView();
   if (pWnd != NULL)
      pWnd->BringWindowToTop();
   m_wndRulerBar.BringWindowToTop();
}

void CInPlaceFrame::RecalcLayout(BOOL bNotify)
{
   if (m_wndResizeBar.m_hWnd != NULL)
      m_wndResizeBar.BringWindowToTop();
   COleIPFrameWndEx::RecalcLayout(bNotify);
   CWnd *pWnd = GetActiveView();
   if (pWnd != NULL)
      pWnd->BringWindowToTop();
   if (m_wndRulerBar.m_hWnd != NULL)
      m_wndRulerBar.BringWindowToTop();

   // at least 12 pt region plus ruler if it exists
   CDisplayIC dc;
   CSize size;
   size.cy = MulDiv(12, dc.GetDeviceCaps(LOGPIXELSY), 72) + 1;
   size.cx = dc.GetDeviceCaps(LOGPIXELSX) / 4; // 1/4"
   size.cx += HORZ_TEXTOFFSET;                 //adjust for offset
   size.cy += VERT_TEXTOFFSET;
   if (m_wndRulerBar.m_hWnd != NULL && m_wndRulerBar.IsVisible())
   {
      CRect rect;
      m_wndRulerBar.GetWindowRect(&rect);
      size.cy += rect.Height();
   }
   m_wndResizeBar.SetMinSize(size);
}

void CInPlaceFrame::CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType)
{
   COleIPFrameWndEx::CalcWindowRect(lpClientRect, nAdjustType);
}

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CFrameWnd

COleIPFrameWnd

COleIPFrameWndEx

Requirements

Header: afxoleipframewndex.h

COleIPFrameWndEx::AddDockSite

void AddDockSite();

Remarks

COleIPFrameWndEx::AddPane

BOOL AddPane(
    CBasePane* pControlBar,
    BOOL bTail = TRUE);

Parameters

[in] pControlBar
[in] bTail

Return Value

Remarks

COleIPFrameWndEx::AdjustDockingLayout

virtual void AdjustDockingLayout(HDWP hdwp = NULL);

Parameters

[in] hdwp

Remarks

COleIPFrameWndEx::DockPane

void DockPane(
    CBasePane* pBar,
    UINT nDockBarID = 0,
    LPCRECT lpRect = NULL);

Parameters

[in] pBar
[in] nDockBarID
[in] lpRect

Remarks

COleIPFrameWndEx::DockPaneLeftOf

Docks one pane to the left of another pane.

BOOL DockPaneLeftOf(
    CPane* pBar,
    CPane* pLeftOf);

Parameters

pBar
[in] A pointer to the pane to dock.

pLeftOf
[in] A pointer to the pane that serves as origin.

Return Value

Returns TRUE if the operation is successful. Otherwise returns FALSE.

Remarks

Call this method to dock several pane objects in a predefined order. This method docks the pane specified by pBar to the left of the pane specified by pLeftOf.

COleIPFrameWndEx::EnableAutoHidePanes

BOOL EnableAutoHidePanes(DWORD dwDockStyle);

Parameters

[in] dwDockStyle

Return Value

Remarks

COleIPFrameWndEx::EnableDocking

BOOL EnableDocking(DWORD dwDockStyle);

Parameters

[in] dwDockStyle

Return Value

Remarks

COleIPFrameWndEx::EnablePaneMenu

void EnablePaneMenu(
    BOOL bEnable,
    UINT uiCustomizeCmd,
    const CString& strCustomizeLabel,
    UINT uiViewToolbarsMenuEntryID,
    BOOL bContextMenuShowsToolbarsOnly = FALSE,
    BOOL bViewMenuShowsToolbarsOnly = FALSE);

Parameters

[in] bEnable
[in] uiCustomizeCmd
[in] strCustomizeLabel
[in] uiViewToolbarsMenuEntryID
[in] bContextMenuShowsToolbarsOnly
[in] bViewMenuShowsToolbarsOnly

Remarks

COleIPFrameWndEx::GetActivePopup

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

CMFCPopupMenu* GetActivePopup() const;

Return Value

A pointer to the active pop-up menu; otherwise NULL.

Remarks

Use this method to obtain a pointer to the CMFCPopupMenu Class object that is currently displayed.

COleIPFrameWndEx::GetContainerFrameWindow

COleCntrFrameWndEx* GetContainerFrameWindow();

Return Value

Remarks

COleIPFrameWndEx::GetDefaultResId

Returns the menu resource ID that was specified when the frame window loaded the menu.

UINT GetDefaultResId() const;

Return Value

Returns the resource ID of the menu, or 0 if the frame window has no menu bar.

Remarks

Call this function to retrieve the resource ID that was specified when the frame window loaded the menu resource by calling COleIPFrameWndEx::LoadFrame.

COleIPFrameWndEx::GetDockFrame

CFrameWnd* GetDockFrame();

Return Value

Remarks

COleIPFrameWndEx::GetDockingManager

CDockingManager* GetDockingManager();

Return Value

Remarks

COleIPFrameWndEx::GetMainFrame

CFrameWnd* GetMainFrame();

Return Value

Remarks

COleIPFrameWndEx::GetMenuBar

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

const CMFCMenuBar* GetMenuBar() const;

Return Value

A pointer to the menu bar object.

Remarks

Use this function to retrieve a pointer to the menu bar object that belongs to the COleIPFrameWndEx object.

COleIPFrameWndEx::GetPane

CBasePane* GetPane(UINT nID);

Parameters

[in] nID

Return Value

Remarks

COleIPFrameWndEx::GetTearOffBars

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

const CObList& GetTearOffBars() const;

Return Value

A reference to a CObList object that contains a collection of pointers to the CBasePane Class-derived objects.

Remarks

The COleIPFrameWndEx object maintains the collection of tear-off menus as a list of CBasePane Class-derived objects. Use this method to retrieve a reference to this list.

COleIPFrameWndEx::GetToolbarButtonToolTipText

Called by the framework before the tooltip for a button is displayed.

virtual BOOL GetToolbarButtonToolTipText(
    CMFCToolBarButton* pButton,
    CString& strTTText);

Parameters

pButton
[in] Pointer to the button.

strTTText
[in] Pointer to the tooltip text.

Return Value

The default implementation returns 0.

Remarks

Override this function to customize the display of tooltips on toolbar buttons.

COleIPFrameWndEx::InitUserToobars

Specifies a range of control IDs that the framework assigns to the user-defined toolbars.

void InitUserToolbars(
    LPCTSTR lpszRegEntry,
    UINT uiUserToolbarFirst,
    UINT uiUserToolbarLast)

Parameters

lpszRegEntry
[in] The registry entry where the library stores user toolbar settings.

uiUserToolbarFirst
[in] Control ID assigned to the first user-defined toolbar.

uiUserToolbarLast
[in] Control ID assigned to the last user-defined toolbar.

Remarks

Use this function to initialize a range of control IDs for assignment to toolbars that users define dynamically. The parameters uiUserToolbarFirst and uiUserToolbarLast define a range of allowed toolbar control IDs. To disable the creation of user-defined toolbars, set uiUserToolbarFirst or uiUserToolbarLast to -1.

COleIPFrameWndEx::InsertPane

BOOL InsertPane(
    CBasePane* pControlBar,
    CBasePane* pTarget,
    BOOL bAfter = TRUE);

Parameters

[in] pControlBar
[in] pTarget
[in] bAfter

Return Value

Remarks

COleIPFrameWndEx::IsMenuBarAvailable

Determines whether the pointer to the menu bar object is not NULL

BOOL IsMenuBarAvailable() const;

Return Value

Returns a non-zero value if the frame window has a menu bar; otherwise returns 0.

Remarks

Call this method to determine whether the frame window maintains a non- NULL pointer to its menu bar object.

COleIPFrameWndEx::IsPointNearDockSite

BOOL IsPointNearDockSite(
    CPoint point,
    DWORD& dwBarAlignment,
    BOOL& bOuterEdge) const;

Parameters

[in] point
[in] dwBarAlignment
[in] bOuterEdge

Return Value

Remarks

COleIPFrameWndEx::LoadFrame

virtual BOOL LoadFrame(
    UINT nIDResource,
    DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE,
    CWnd* pParentWnd = NULL,
    CCreateContext* pContext = NULL);

Parameters

[in] nIDResource
[in] dwDefaultStyle
[in] pParentWnd
[in] pContext

Return Value

Remarks

COleIPFrameWndEx::OnCloseDockingPane

virtual BOOL OnCloseDockingPane(CDockablePane*);

Parameters

[in] CDockablePane*

Return Value

Remarks

COleIPFrameWndEx::OnCloseMiniFrame

virtual BOOL OnCloseMiniFrame(CPaneFrameWnd*);

Parameters

[in] CPaneFrameWnd*

Return Value

Remarks

COleIPFrameWndEx::OnClosePopupMenu

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

virtual void OnClosePopupMenu(CMFCPopupMenu* pMenuPopup);

Parameters

pMenuPopup
[in] A pointer to the pop-up menu object.

Remarks

Override this method to receive notifications from CMFCPopupMenu objects when they process WM_DESTROY messages.

COleIPFrameWndEx::OnCmdMsg

virtual BOOL OnCmdMsg(
    UINT nID,
    int nCode,
    void* pExtra,
    AFX_CMDHANDLERINFO* pHandlerInfo);

Parameters

[in] nID
[in] nCode
[in] pExtra
[in] pHandlerInfo

Return Value

Remarks

COleIPFrameWndEx::OnDrawMenuImage

Called by the framework when the image that is associated with a menu item is drawn.

virtual BOOL OnDrawMenuImage(
    CDC* pDC,
    const CMFCToolBarMenuButton* pMenuButton,
    const CRect& rectImage);

Parameters

pDC
[in] Pointer to the device context.

pMenuButton
[in] Pointer to the menu button.

rectImage
[in] The image associated with the menu item.

Return Value

The default implementation does nothing and returns 0.

Remarks

Override this method if you want to customize image drawing for the menu items that belong to the menu bar owned by the COleIPFrameWndEx-derived object.

Called by the framework when a CMFCPopupMenuobject processes a WM_PAINT message.

virtual void OnDrawMenuLogo(
    CDC* pDC,
    CMFCPopupMenu* pMenu,
    const CRect& rectLogo);

Parameters

pDC
[in] Pointer to the device context.

pMenu
[in] Pointer to the pop-up menu object.

rectLogo
[in] Pointer to the logo to display.

Remarks

Override this method to display a logo on the pop-up menu associated with the menu bar owned by the COleIPFrameWndEx-derived object. The default implementation does nothing.

COleIPFrameWndEx::OnMenuButtonToolHitTest

Called by the framework when a CMFCToolBarButtonobject processes a WM_NCHITTEST message.

virtual BOOL OnMenuButtonToolHitTest(
    CMFCToolBarButton* pButton,
    TOOLINFO* pTI);

Parameters

[in] pButton Pointer to a menu button.

[out] pTI Pointer to a TOOLINFO structure.

Return Value

The default implementation does nothing and returns 0. Your implementation should return a non-zero value if it fills the pTI parameter.

Remarks

Override this method to provide ToolTip information about a specific menu item.

COleIPFrameWndEx::OnMoveMiniFrame

virtual BOOL OnMoveMiniFrame(CWnd* pFrame);

Parameters

[in] pFrame

Return Value

Remarks

COleIPFrameWndEx::OnSetPreviewMode

virtual void OnSetPreviewMode(
    BOOL bPreview,
    CPrintPreviewState* pState);

Parameters

[in] bPreview
[in] pState

Remarks

COleIPFrameWndEx::OnShowCustomizePane

virtual BOOL OnShowCustomizePane(
    CMFCPopupMenu* pMenuPane,
    UINT uiToolbarID);

Parameters

[in] pMenuPane
[in] uiToolbarID

Return Value

Remarks

COleIPFrameWndEx::OnShowPanes

virtual BOOL OnShowPanes(BOOL bShow);

Parameters

[in] bShow

Return Value

Remarks

COleIPFrameWndEx::OnShowPopupMenu

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

virtual BOOL OnShowPopupMenu(CMFCPopupMenu* pMenuPopup);

Parameters

pMenuPopup
[in] Pointer to the pop-up menu to be displayed.

Return Value

The default implementation does nothing and returns a non-zero value. Your implementation should return FALSE if the pop-up menu cannot be displayed.

Remarks

Override this method to customize the display of a pop-up menu. For example, you could change the menu buttons to color menu buttons or initialize tear-off bars.

COleIPFrameWndEx::OnTearOffMenu

Called by the framework when the user selects a menu that has a tear-off bar.

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

Parameters

pMenuPopup
[in] A pointer to the pop-up menu that the user selected.

pBar
[in] A pointer to the pane that hosts the menu.

Return Value

TRUE if you want the framework to activate the pop-up menu; otherwise FALSE. The default value is TRUE.

Remarks

Override this function if you want to customize the setup of the tear-off bar.

COleIPFrameWndEx::PaneFromPoint

CBasePane* PaneFromPoint(
    CPoint point,
    int nSensitivity,
    bool bExactBar,
    CRuntimeClass* pRTCBarType) const;

CBasePane* PaneFromPoint(
    CPoint point,
    int nSensitivity,
    DWORD& dwAlignment,
    CRuntimeClass* pRTCBarType) const;

Parameters

[in] point
[in] nSensitivity
[in] bExactBar
[in] pRTCBarType
[in] dwAlignment

Return Value

Remarks

COleIPFrameWndEx::PreTranslateMessage

virtual BOOL PreTranslateMessage(MSG* pMsg);

Parameters

[in] pMsg

Return Value

Remarks

COleIPFrameWndEx::RecalcLayout

virtual void RecalcLayout(BOOL bNotify = TRUE);

Parameters

[in] bNotify

Remarks

COleIPFrameWndEx::RemovePaneFromDockManager

void RemovePaneFromDockManager(
    CBasePane* pControlBar,
    BOOL bDestroy,
    BOOL bAdjustLayout,
    BOOL bAutoHide,
    CBasePane* pBarReplacement);

Parameters

[in] pControlBar
[in] bDestroy
[in] bAdjustLayout
[in] bAutoHide
[in] pBarReplacement

Remarks

COleIPFrameWndEx::SetDockState

Applies the specified docking state to panes that belong to the frame window.

void SetDockState(const CDockState& state);

Parameters

state
[in] Specifies the docking state.

Remarks

Use this function to specify a new docking state for panes that belong to the COleIPFrameWndEx object.

COleIPFrameWndEx::SetupToolbarMenu

Modifies a toolbar object by searching for dummy items and replacing them with the specified user-defined items.

void SetupToolbarMenu(
    CMenu& menu,
    const UINT uiViewUserToolbarCmdFirst,
    const UINT uiViewUserToolbarCmdLast);

Parameters

menu
[in] A reference to a CMenu object to be modified.

uiViewUserToolbarCmdFirst
[in] Specifies the first user-defined command.

uiViewUserToolbarCmdLast
[in] Specifies the last user-defined command.

Remarks

COleIPFrameWndEx::ShowPane

void ShowPane(
    CBasePane* pBar,
    BOOL bShow,
    BOOL bDelay,
    BOOL bActivate);

Parameters

[in] pBar
[in] bShow
[in] bDelay
[in] bActivate

Remarks

COleIPFrameWndEx::WinHelpA

Called by the framework to initiate the WinHelp application or context help.

virtual void WinHelp(
    DWORD dwData,
    UINT nCmd = HELP_CONTEXT);

Parameters

[in] dwData Specifies data as required for the type of help specified by nCmd.

nCmd
[in] Specifies the type of help requested. For a list of possible values and how they affect the dwData parameter, see the WinHelp Function in the Windows SDK.

Remarks

See also

Hierarchy Chart
Classes
CFrameWndEx Class
CMDIFrameWndEx Class