<?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[Dialog als Hauptfenster]]></title><description><![CDATA[<p>Hallo, wie kann ich einen Dialog als Hauptfenster einer Anwendung anzeigen lassen? Ausgangspunkt ist ein mit Visual Studio 2008 erstelltes Win 32 Programm. Wenn ich dieses Kompiliere habe ich ein Fenster mit Menü und einem leeren weißen Haupfenster. Dieses leere Hauptfenster möchte ich jetzt sozusagen durch einen Dialog ersetzen. Versucht habe ich es folgendermaßen:</p>
<pre><code>int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

 	MSG msg;
	HACCEL hAccelTable;

	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_KEYGENERATOR, szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);

	if (!InitInstance (hInstance, nCmdShow))
	{
		return FALSE;
	}

	hDlgModeless = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_MAIN_DLG), hWnd, (DLGPROC)WndProcDlg);

    hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_KEYGENERATOR));

	while (GetMessage(&amp;msg, NULL, 0, 0))
	{
		if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg))
		{
			TranslateMessage(&amp;msg);
			DispatchMessage(&amp;msg);
		}
	}

	return (int) msg.wParam;
}
</code></pre>
<p>Der Aufruf von CreateDialog führt leider nicht zum Erfolg. Habe ich etwas vergessen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/217215/dialog-als-hauptfenster</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 11:17:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/217215.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 04 Jul 2008 15:16:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dialog als Hauptfenster on Fri, 04 Jul 2008 15:16:25 GMT]]></title><description><![CDATA[<p>Hallo, wie kann ich einen Dialog als Hauptfenster einer Anwendung anzeigen lassen? Ausgangspunkt ist ein mit Visual Studio 2008 erstelltes Win 32 Programm. Wenn ich dieses Kompiliere habe ich ein Fenster mit Menü und einem leeren weißen Haupfenster. Dieses leere Hauptfenster möchte ich jetzt sozusagen durch einen Dialog ersetzen. Versucht habe ich es folgendermaßen:</p>
<pre><code>int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

 	MSG msg;
	HACCEL hAccelTable;

	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_KEYGENERATOR, szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);

	if (!InitInstance (hInstance, nCmdShow))
	{
		return FALSE;
	}

	hDlgModeless = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_MAIN_DLG), hWnd, (DLGPROC)WndProcDlg);

    hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_KEYGENERATOR));

	while (GetMessage(&amp;msg, NULL, 0, 0))
	{
		if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg))
		{
			TranslateMessage(&amp;msg);
			DispatchMessage(&amp;msg);
		}
	}

	return (int) msg.wParam;
}
</code></pre>
<p>Der Aufruf von CreateDialog führt leider nicht zum Erfolg. Habe ich etwas vergessen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1541093</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1541093</guid><dc:creator><![CDATA[Student83]]></dc:creator><pubDate>Fri, 04 Jul 2008 15:16:25 GMT</pubDate></item><item><title><![CDATA[Reply to Dialog als Hauptfenster on Fri, 04 Jul 2008 17:30:56 GMT]]></title><description><![CDATA[<p>Du erzeugst nur das Dialogfenster, rufst dieses aber nicht explizit auf. Hier ist in der Warteschleife des Hauptfensters ein solcher Aufruf erforderlich, der ähnlich wie aus einem Menüpunkt zu erfolgen hat. Ansonsten: mit SendMessage(...) geht alles! Und überhaupt: Fenster bleiben Fenster, man kann sie gegenseitig nicht ersetzen, nur die Anzeige und etwas mehr beeinflussen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1541174</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1541174</guid><dc:creator><![CDATA[berniebutt]]></dc:creator><pubDate>Fri, 04 Jul 2008 17:30:56 GMT</pubDate></item><item><title><![CDATA[Reply to Dialog als Hauptfenster on Fri, 04 Jul 2008 21:45:51 GMT]]></title><description><![CDATA[<p>Welches hWnd gibst Du der Funktion &quot;CreateDialog&quot; mit? Es wird nirgendwo deklariert/initialisiert und muss beim TopLevel-Window Deiner Anwendung NULL sein. Deine MessageLoop sollte übrigens auch &quot;IsDialogMessage&quot; aufrufen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1541295</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1541295</guid><dc:creator><![CDATA[_mgs]]></dc:creator><pubDate>Fri, 04 Jul 2008 21:45:51 GMT</pubDate></item><item><title><![CDATA[Reply to Dialog als Hauptfenster on Sat, 05 Jul 2008 10:44:08 GMT]]></title><description><![CDATA[<p>EDIT:</p>
<p>Hat sich erledigt, ich hatte den Aufruf von</p>
<pre><code>ShowWindow(hDlg,SW_SHOW);
</code></pre>
<p>für das Dialogfenster vergessen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1541375</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1541375</guid><dc:creator><![CDATA[Student83]]></dc:creator><pubDate>Sat, 05 Jul 2008 10:44:08 GMT</pubDate></item></channel></rss>