I'm developing a SDI project with MFC 2010 using the 'new' MFC feature pack to add some stuffs.
The template added me the Calendar bar and Tree bar, pretty unuseful to my application. I removed some of them and replaced one with a CDialogEx derived class and everything works fine.
Now, I want to definitely remove all of old template panel and use mines, but as soon as I remove the code commenting it, the whole control will not show anymore.
Worst part, if I decomment the control still not show. Sometimes, removing the registry key associated will let the control show for just one run.
I'll paste code:
///////////////////////////////////////////> .H File
class CMainFrame : public CFrameWndEx
{
DECLARE_DYNCREATE(CMainFrame)
DECLARE_MESSAGE_MAP()
protected:
CCalendarBar m_wndCalendar; //> Old pane
CEliCUTP140PannelloDlg* m_pPannelloDlg; //> Derived from CDialogEx
CMFCMenuBar m_wndMenuBar;
CMFCOutlookBar m_wndBarraPannelli; //> Outlook bar
CMFCOutlookBarPane* m_pCurrOutlookPage; //> Dunno what's for
CMFCOutlookBarTabCtrl* m_pCurrOutlookWnd; //> Same as above
CMFCShellTreeCtrl m_wndTree; //> Old pane
CMFCStatusBar m_wndStatusBar;
CMFCToolBar m_wndToolBar;
CMFCToolBarImages m_UserImages;
//////////////////////////////////////////> .CPP file.
m_wndBarraPannelli.SetMode2003();
if (strTemp.LoadString(theApp.m_hRisorse, IDS_SHORTCUTS) == FALSE)
{
m_Log.AddString(_T("CMainFrame::CreateOutlookBar - Impossibile caricare la stringa IDS_SHORTCUTS."));
throw CGUIException(E_GE_IMP_CAR_STR);
}
dwOpzioni = WS_CHILD | WS_VISIBLE | CBRS_LEFT;
if (m_wndBarraPannelli.Create(strTemp, this, CRect(0, 0, nInitialWidth, 32000), uiID, dwOpzioni, AFX_CBRS_OUTLOOK_TABS) == FALSE)
return FALSE;
dwStyle = AFX_CBRS_FLOAT | AFX_CBRS_AUTOHIDE | AFX_CBRS_RESIZE;
dwOpzioni = CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC;
m_wndBarraPannelli.SetPaneStyle(m_wndBarraPannelli.GetPaneStyle() | dwOpzioni);
m_wndBarraPannelli.SetButtonsFont(&afxGlobalData.fontBold);
pOutlookBar = (CMFCOutlookBarTabCtrl *)m_wndBarraPannelli.GetUnderlyingWindow();
if (pOutlookBar == NULL)
return FALSE;
pOutlookBar->EnableInPlaceEdit(FALSE);
pOutlookBar->EnableAnimation(TRUE);
pOutlookBar->EnableScrollButtons();
pOutlookBar->SetBorderSize(1);
pOutlookBar->SetPageButtonTextAlign(TA_LEFT);
/* the last panel which I'm trying to remove
const DWORD dwTreeStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS;
tree.Create(dwTreeStyle, rectDummy, pOutlookBar, 1200);
if (strTemp.LoadString(theApp.m_hRisorse, IDS_FOLDERS) == FALSE)
{
m_Log.AddString(_T("CMainFrame::CreateOutlookBar - Impossibile caricare la stringa IDS_FOLDERS."));
throw CGUIException(E_GE_IMP_CAR_STR);
}
pOutlookBar->AddControl(&tree, strTemp, 2, TRUE, dwStyle);**/
if (m_pPannelloDlg == NULL)
m_pPannelloDlg = new CEliCUTP140PannelloDlg();
m_pPannelloDlg->m_pSuperParent = this;
bNameValid = m_pPannelloDlg->Create(IDD_ELICUTP140PANNELLODLG, &m_wndBarraPannelli);
m_pPannelloDlg->ShowWindow(SW_SHOW);
if (strTemp.LoadString(theApp.m_hRisorse, IDS_PAN_MOV) == FALSE)
{
m_Log.AddString(_T("CMainFrame::CreateOutlookBar - Impossibile caricare la stringa IDS_PAN_MOV."));
throw CGUIException(E_GE_IMP_CAR_STR);
}
pOutlookBar->AddControl(m_pPannelloDlg, strTemp, 0, TRUE, dwStyle);
m_wndBarraPannelli.ShowWindow(SW_SHOW);
pOutlookBar->SetImageList(theApp.m_bHiColorIcons ? IDB_PAGES_HC : IDB_PAGES, 24);
pOutlookBar->SetToolbarImageList(theApp.m_bHiColorIcons ? IDB_PAGES_SMALL_HC : IDB_PAGES_SMALL, 16);
pOutlookBar->RecalcLayout();
bAnimation = theApp.GetInt(_T("OutlookAnimation"), TRUE);
CMFCOutlookBarTabCtrl::EnableAnimation(bAnimation);
If I should paste extra code let me know. Any help appreciated.