Hello.
I have a Multi-Top-Level-Documents based application.
After a button click, the application should create a new main frame based on a new doc-template.
The message handler:
The function:
There's no error while compiling, and also no runtime errors, but the new frame is not displayed. Why?
The current main frame is closed succesfull.
A-jage
I have a Multi-Top-Level-Documents based application.
After a button click, the application should create a new main frame based on a new doc-template.
The message handler:
Code:
void CDesktopChatMessengerView::OnClicked()
{
theApp.NewFrame();
}
The function:
Code:
void CDesktopChatMessengerApp::NewFrame()
{
CMultiDocTemplate* pContactDocTemplate;
pContactDocTemplate = new CMultiDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CDesktopChatMessengerContactDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CDesktopChatMessengerContactView));
m_pDocTemplate = pContactDocTemplate;
AddDocTemplate(pContactDocTemplate);
CDocument* pDoc = NULL;
CFrameWnd* pFrame = NULL;
pDoc = m_pDocTemplate->CreateNewDocument();
pFrame = m_pDocTemplate->CreateNewFrame(NULL, NULL);
if (pFrame != NULL)
{
// Set the title, and initialize the document.
m_pDocTemplate->SetDefaultTitle(pDoc);
m_pDocTemplate->InitialUpdateFrame(pFrame, pDoc, TRUE);
}
pFrame->ShowWindow(SW_SHOW);
pFrame->UpdateWindow();
//Close login_window
m_pMainWnd->DestroyWindow();
}
There's no error while compiling, and also no runtime errors, but the new frame is not displayed. Why?
The current main frame is closed succesfull.
A-jage