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 Tech Support » Assert in CExtCmdManager::ProfileWndAdd ProfileGetPtr Collapse All
Subject Author Date
Bill Olson Oct 7, 2010 - 4:37 AM

I am attempting to create my own application, and wanted an outer bar like you have in the MDI_DynamicInnerOuterBar sample.  I noticed that the app wizard for my new application put the following in the MainFrame::OnCreate()


 



[code]


    VERIFY(g_CmdManager->ProfileWndAdd(__PROF_UIS_PROJECT_CMD_PROFILE_NAME,GetSafeHwnd()));

    VERIFY(g_CmdManager->UpdateFromMenu(__PROF_UIS_PROJECT_CMD_PROFILE_NAME,IDR_MAINFRAME));

    VERIFY(g_CmdManager->UpdateFromMenu(__PROF_UIS_PROJECT_CMD_PROFILE_NAME,IDR_MAINFRAME));

    VERIFY(g_CmdManager->UpdateFromMenu(__PROF_UIS_PROJECT_CMD_PROFILE_NAME,IDR_MultiTraceVITYPE);


[/code]



 


In the MDI_DynamicInnerOuterBars example, the same block of code is:


 



[code]


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

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

    VERIFY(g_CmdManager->UpdateFromMenu(pApp->m_pszProfileName,IDR_MDIDOCTYPE));

    VERIFY(g_CmdManager->UpdateFromMenu(pApp->m_pszProfileName,IDR_OUTER_DYNAMIC_BAR));

    VERIFY(g_CmdManager->UpdateFromMenu(pApp->m_pszProfileName,IDR_INNER_DYNAMIC_BAR));


[/code]



 


I found that if I used the pApp->pszProfileName as it is used in the sample, I got an assert in CExtCmdManager::ProfileWndAdd() when it got pProfile:


 



[code]


CExtCmdProfile * pProfile = ProfileGetPtr( sProfileName );


[/code]



 


pProfile would come back 0.  Looking at this in the debugger in the sample, it comes back with a value.


Initially, I didn’t care too much about it until I tried to create the outer bar and got the same assert in the same location when I created the bar and had this line a few lines later:


 



[code]


    pCmdItem = g_CmdManager->CmdGetPtr(pApp->m_pszProfileName,nCmdID);


[/code]



 


I assume there is something in the initialization of the main frame that I missed from the sample, but I can’t find it.  I have compared the code between the sample and my code and as far as I can tell, I’m doing all the same initialization.  What sets the value so pProfile is not NULL?

Bill Olson Oct 14, 2010 - 2:35 AM

That did it. 


Thanks,


Bill

Technical Support Oct 7, 2010 - 11:50 AM

The MDI_DynamicInnerOuterBars sample invokes the g_CmdManager->ProfileWndAdd( . . . ) code in the CMainFrame::OnCreate() method because the CMDI_DynamicInnerOuterBarsApp::SetupUiAdvancedOptions() method is already created a new command manager’s profile by invoking the g_CmdManager->ProfileSetup( . . . ) code. You can add new windows only into existing command profiles.