<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Neues Hauptfenster mit CreateNewFrame() erzeugen.]]></title><description><![CDATA[<p>Hello.</p>
<p>I have a Multi-Top-Level-Documents based application.</p>
<p>After a button click, the application should create a new main frame based on a new doc-template.</p>
<p>The message handler:</p>
<pre><code class="language-cpp">void CDesktopChatMessengerView::OnClicked()
{
	theApp.NewFrame();	
}
</code></pre>
<p>The function:</p>
<pre><code class="language-cpp">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-&gt;CreateNewDocument();
	pFrame = m_pDocTemplate-&gt;CreateNewFrame(NULL, NULL);
		if (pFrame != NULL)
		{
			// Set the title, and initialize the document.
			m_pDocTemplate-&gt;SetDefaultTitle(pDoc);

			m_pDocTemplate-&gt;InitialUpdateFrame(pFrame, pDoc, TRUE);
		}

	pFrame-&gt;ShowWindow(SW_SHOW);
	pFrame-&gt;UpdateWindow();

        //Close login_window
	m_pMainWnd-&gt;DestroyWindow();
}
</code></pre>
<p>There's no error while compiling, and also no runtime errors, but the new frame is not displayed. Why?<br />
The current main frame is closed succesfull.</p>
<p>A-jage</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/196320/neues-hauptfenster-mit-createnewframe-erzeugen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Apr 2026 12:00:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/196320.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 28 Oct 2007 11:57:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Neues Hauptfenster mit CreateNewFrame() erzeugen. on Sun, 28 Oct 2007 11:57:39 GMT]]></title><description><![CDATA[<p>Hello.</p>
<p>I have a Multi-Top-Level-Documents based application.</p>
<p>After a button click, the application should create a new main frame based on a new doc-template.</p>
<p>The message handler:</p>
<pre><code class="language-cpp">void CDesktopChatMessengerView::OnClicked()
{
	theApp.NewFrame();	
}
</code></pre>
<p>The function:</p>
<pre><code class="language-cpp">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-&gt;CreateNewDocument();
	pFrame = m_pDocTemplate-&gt;CreateNewFrame(NULL, NULL);
		if (pFrame != NULL)
		{
			// Set the title, and initialize the document.
			m_pDocTemplate-&gt;SetDefaultTitle(pDoc);

			m_pDocTemplate-&gt;InitialUpdateFrame(pFrame, pDoc, TRUE);
		}

	pFrame-&gt;ShowWindow(SW_SHOW);
	pFrame-&gt;UpdateWindow();

        //Close login_window
	m_pMainWnd-&gt;DestroyWindow();
}
</code></pre>
<p>There's no error while compiling, and also no runtime errors, but the new frame is not displayed. Why?<br />
The current main frame is closed succesfull.</p>
<p>A-jage</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1393525</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1393525</guid><dc:creator><![CDATA[a-jage]]></dc:creator><pubDate>Sun, 28 Oct 2007 11:57:39 GMT</pubDate></item><item><title><![CDATA[Reply to Neues Hauptfenster mit CreateNewFrame() erzeugen. on Mon, 29 Oct 2007 08:21:35 GMT]]></title><description><![CDATA[<p>Wird das Frame-Window erzeugt und ist im Spy++ sichtbar. Ist evtl. die Fenster-Hierarchy falsch? Kontrolliere die Fenster-Stileim Spy++!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1393938</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1393938</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Mon, 29 Oct 2007 08:21:35 GMT</pubDate></item></channel></rss>