Re: Doc/View architecture (SDI) first view
CSingleDocTemplate* pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMainDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame wnd
pViewClass <--------------------------What is this?
RUNTIME_CLASS(CMainView)
);
if (!pDocTemplate) {
return FALSE;
}
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
//if new view is supposed to be created, do nothing
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
if (!ProcessShellCommand(cmdInfo))
{
return FALSE;
}
//create a new view
CMainDoc *pDoc = new CMainDoc()
pDocTemplate->AddDocument(pDoc);
CChildFrame* FrameWnd =
(CChildFrame*)pDocTemplate->CreateNewFrame(pDoc,NULL);
if (FrameWnd)
{
FrameWnd->SetTitle("New Document");
FrameWnd->InitialUpdateFrame(pDoc,TRUE);
FrameWnd->SetFocus();
}
Obviously this is going to do exactly the same as if you were to do nothing
with code at all, in other words it will create the same kind of view as it
would by default. If you want to create a different type of view, then you
will need a different CSingleDocTemplate.
AliR.
"mosfet" <john.doe@anonymous.org> wrote in message
news:47554c45$0$28932$426a74cc@news.free.fr...
Hi,
I would like for some reasons be able to create the first initial view of
my SDI application and I don't know how to do it.
For now here is the standard code :
=
CSingleDocTemplate* pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMainDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame wnd
pViewClass
);
if (!pDocTemplate) {
return FALSE;
}
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line. Will return FALSE if
// app was launched with /RegServer, /Register, /Unregserver or
/Unregister.
if (!ProcessShellCommand(cmdInfo)) {
return FALSE;
}
I would like to replace this code and to handle the view creation myself.