Share via


CMFCToolBar::LoadToolBar

Loads the toolbar from application resources.

virtual BOOL LoadToolBar(
   UINT uiResID,
   UINT uiColdResID=0,
   UINT uiMenuResID=0,
   BOOL bLocked=FALSE,
   UINT uiDisabledResID=0,
   UINT uiMenuDisabledResID=0,
   UINT uiHotResID=0 
);

Parameters

  • [in] uiResID
    The resource ID of the toolbar.

  • [in] uiColdResID
    The resource ID of the bitmap that refers to the cold toolbar images.

  • [in] uiMenuResID
    The resource ID of the bitmap that refers to the regular menu images.

  • [in] bLocked
    A Boolean value that specifies whether the toolbar is locked or not. If this parameter is TRUE, the toolbar is locked. Otherwise, the toolbar is not locked.

  • [in] uiDisabledResID
    The resource ID of the bitmap that refers to the disabled toolbar images.

  • [in] uiMenuDisabledResID
    The resource ID of the bitmap that refers to the disabled menu images.

  • [in] uiHotResID
    The resource ID of the bitmap that refers to the hot toolbar images.

Return Value

Nonzero if the method succeeds; otherwise 0.

Remarks

The framework calls this method during initialization to load the images that are associated with the toolbar.

Example

The following example demonstrates how to use the LoadToolBar method in the CMFCToolBar class. This code snippet is part of the IE Demo sample.

  CMFCToolBar     m_wndToolBar;


...


    // The this pointer points to CMainFrame class which extends the CFrameWnd class. 
    if (!m_wndToolBar.CreateEx (this, TBSTYLE_TRANSPARENT) ||
        !m_wndToolBar.LoadToolBar (IDR_MAINFRAME, uiToolbarColdID, uiMenuID, 
            FALSE /* Not locked */, 0, 0, uiToolbarHotID))
    {
        TRACE0("Failed to create toolbar\n");
        return -1;      // fail to create
    }

Requirements

Header: afxtoolbar.h

See Also

Reference

CMFCToolBar Class

Hierarchy Chart