If I defines views in the OnCreateClient functions,it works well :
BOOL
CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext*
pContext)
{
CRuntimeClass* lViewRuntimeClass = RUNTIME_CLASS(CProcessMemoryView);=
mTabFont.CreateFont(12, 0, 0, 0, FW_NORMAL, FALSE, FALSE,
0,ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH, _T("Arial"));
// Create tab control
if(!mTabCtrl.Create(WS_CHILD|WS_VISIBLE|
TCS_BOTTOM,CRect(0,0,0,0),this,AFX_IDW_PANE_FIRST))
return FALSE;
mTabCtrl.SetFont(&mTabFont,TRUE);
TCITEM lItem={0};
if(mTabCtrl.InsertItem(0,&lItem)==-1)
return FALSE;
pContext->m_pNewViewClass=lViewRuntimeClass;
CWnd* pView=CreateView(pContext,AFX_IDW_PANE_FIRST+1);
if(NULL==pView)
{
TRACE("CMainFrame::OnCreateClient -E- can not create view\r");
return FALSE;
}
mViewsVector.push_back(DYNAMIC_DOWNCAST(CView,pView));
SetActiveView(DYNAMIC_DOWNCAST(CView,pView));
CProcessMemoryDoc* lDocument =
static_cast<CProcessMemoryDoc*>(GetActiveDocument());
std::basic_string<TCHAR> lWatchName = lDocument-
GetAvailableWatchName();
lItem.mask = TCIF_TEXT;
lItem.pszText = (LPWSTR)lWatchName.c_str();
mTabCtrl.SetItem(0,&lItem);
lDocument->AddWatch(lWatchName);
return true;
}
Any idea?
Thank you in advance.
Nassim.