Здравствуйте Snoop, Вы писали:
O$>>Делай выбор в InitInstance (посмотри как она сделана для SDI и Dialog-Based)
S>Спасибо, но это при старте. А как переключится в процессе работы?
Пример из МСДН
Переключение View
void CMainFrame::OnExample(UINT nCmdID) // Обработчик нажатия кнопок переключающих вьювы
{
if (nCmdID == m_nCurrentExample)
return; // already selected
// Set the child window ID of the active view to AFX_IDW_PANE_FIRST.
// This is necessary so that CFrameWnd::RecalcLayout will allocate
// this "first pane" to that portion of the frame window's client
// area not allocated to control bars. Set the child ID of
// the previously active view to some other ID; we will use the
// command ID as the child ID.
CView* pOldActiveView = GetActiveView();
::SetWindowLong(pOldActiveView->m_hWnd, GWL_ID, m_nCurrentExample);
CRuntimeClass* pNewViewClass;
switch (nCmdID)
{
case ID_STRINGLIST:
pNewViewClass = RUNTIME_CLASS(CStringListView);
break;
case ID_TYPEDLIST:
pNewViewClass = RUNTIME_CLASS(CTypedPtrListView);
break;
case ID_INTLIST:
pNewViewClass = RUNTIME_CLASS(CIntListView);
break;
default:
ASSERT(0);
return;
}
// create the new view
CCreateContext context;
context.m_pNewViewClass = pNewViewClass;
context.m_pCurrentDoc = GetActiveDocument();
CView* pNewView = STATIC_DOWNCAST(CView, CreateView(&context));
if (pNewView != NULL)
{
// the new view is there, but invisible and not active...
pNewView->ShowWindow(SW_SHOW);
pNewView->OnInitialUpdate();
SetActiveView(pNewView);
RecalcLayout();
m_nCurrentExample = nCmdID;
// finally destroy the old view...
pOldActiveView->DestroyWindow();
}
}
Удачи.