Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » CExtToolControlBar Collapse All
Subject Author Date
Denis Tomashenko Dec 5, 2005 - 6:09 AM

Why bitmaps don’t display in toolbar? :(

 

I’m use standard code:

 

if((!m_wndToolBar.Create(NULL, this, AFX_IDW_TOOLBAR)) || (!m_wndToolBar.LoadToolBar(IDR_MAINFRAME)))


{


TRACE0("Failed to create toolbar\n");


return -1;


}


 

Toolbar was created. But withot images.

What I do wrong? Help, please.

Technical Support Dec 6, 2005 - 10:23 AM

You cannot see images in toolbars only if you forgot to initialize the command manager for your main frame or dialog window. If you don’t call g_CmdManager->ProfileSetup() and/or g_CmdManager->ProfileWndAdd() code during the application startup with specifying HWND of your main frame or dialog window in it, then both toolbars and popup menus will not be able to find command descriptions (with icons, menu texts, tip texts and etc.) in the command manager. So, just make sure that it has been done.

Olivier Booklage Feb 11, 2007 - 9:54 AM

... And also do not forget to call ProfileWndAdd & UpdateFromMenu in :

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
CWinApp * pApp = ::AfxGetApp();
    ASSERT( pApp != NULL );
    ASSERT( pApp->m_pszRegistryKey != NULL );
    ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
    ASSERT( pApp->m_pszProfileName != NULL );
    ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );

    if( CExtNCW < CFrameWnd > :: OnCreate( lpCreateStruct ) == -1 )
    {
        ASSERT( FALSE );
        return -1;
    }

    VERIFY(
        g_CmdManager->ProfileWndAdd(
            pApp->m_pszProfileName,
            GetSafeHwnd()
            )
        );
    VERIFY(
        g_CmdManager->UpdateFromMenu(
            pApp->m_pszProfileName,
            IDR_MAINFRAME
            )
        );

..etc

Regards,

Olivier.