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?