<?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[Erstellen eines normalen Windows mittels Dialog-Button]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe ein Problem, ein normales Window zu starten, wenn ich auf einen Button in meinem Haupt-Dialog-Fenster drücke. Ich brauche aber ein leeres Fenster, um darin später dann OpenGL zu starten. Hier ist mein fehlerhafter Code zu diesem Problem. Danke für nützliche Hinweise!</p>
<p>CODE:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;resource.h&quot; 

HWND hwnd			= NULL;
HBRUSH g_hbrBackground	= NULL;
const char lpClassName[]	= &quot;myWindowClass&quot;;

BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
	int i=210;
	switch(Message)
	{
	case WM_INITDIALOG:

g_hbrBackground = CreateSolidBrush(RGB(i, i, i));
SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)));
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)));

		break;

		case WM_CLOSE:
			EndDialog(hwnd, 0);
		break;

		case WM_CTLCOLORDLG:	
			return (LONG)g_hbrBackground;

		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case IDOK:
				EndDialog(hwnd, 0);
				break;

				case IDD_BUTTON1:
				ShowWindow(hwnd, SW_SHOW);
				while(GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0)
					{
					TranslateMessage(&amp;Msg);
					DispatchMessage(&amp;Msg);
					}
				return Msg.wParam;

				case IDCANCEL:
					EndDialog(hwnd, 0);
				break;
			}
		break;

			case WM_DESTROY:
			DeleteObject(g_hbrBackground);
		  break;

		default:
		return FALSE;
	}
	return TRUE;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case IDM_EXIT:
				DestroyWindow(hwnd);
				break;

				default:
				return FALSE;
			}
		break;	

		case WM_CLOSE:
			DestroyWindow(hwnd);
		break;
		case WM_DESTROY:
			PostQuitMessage(0);
		break;

		default:
		return DefWindowProc(hwnd, msg, wParam, lParam);
	}
	return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
	LPSTR lpCmdLine, int nCmdShow)
{
	WNDCLASSEX wc;
	MSG Msg;

	wc.cbSize		 = sizeof(WNDCLASSEX);
	wc.style		 = 0;
	wc.lpfnWndProc	 = WndProc;
	wc.cbClsExtra	 = 0;
	wc.cbWndExtra	 = 0;
	wc.hInstance	 = hInstance;
	wc.hIcon		 = LoadIcon(NULL, IDI_APPLICATION);
	wc.hCursor		 = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+18);
	wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MENU1);;
	wc.lpszClassName = lpClassName;
	wc.hIconSm		 = LoadIcon(NULL, IDI_APPLICATION);

	RegisterClassEx(&amp;wc);

	hwnd = CreateWindowEx(
		WS_EX_CLIENTEDGE,
		lpClassName,
		&quot;My Window&quot;,
		WS_OVERLAPPEDWINDOW,
		0, 0, 480, 240,
		NULL, NULL, hInstance, NULL);

	return DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIALOG1),hwnd, DlgProc);
}
</code></pre>
<p>edit: sfds</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/127304/erstellen-eines-normalen-windows-mittels-dialog-button</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Jul 2026 16:09:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/127304.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 Nov 2005 09:01:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Erstellen eines normalen Windows mittels Dialog-Button on Wed, 23 Nov 2005 10:49:56 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe ein Problem, ein normales Window zu starten, wenn ich auf einen Button in meinem Haupt-Dialog-Fenster drücke. Ich brauche aber ein leeres Fenster, um darin später dann OpenGL zu starten. Hier ist mein fehlerhafter Code zu diesem Problem. Danke für nützliche Hinweise!</p>
<p>CODE:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;resource.h&quot; 

HWND hwnd			= NULL;
HBRUSH g_hbrBackground	= NULL;
const char lpClassName[]	= &quot;myWindowClass&quot;;

BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
	int i=210;
	switch(Message)
	{
	case WM_INITDIALOG:

g_hbrBackground = CreateSolidBrush(RGB(i, i, i));
SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)));
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)));

		break;

		case WM_CLOSE:
			EndDialog(hwnd, 0);
		break;

		case WM_CTLCOLORDLG:	
			return (LONG)g_hbrBackground;

		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case IDOK:
				EndDialog(hwnd, 0);
				break;

				case IDD_BUTTON1:
				ShowWindow(hwnd, SW_SHOW);
				while(GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0)
					{
					TranslateMessage(&amp;Msg);
					DispatchMessage(&amp;Msg);
					}
				return Msg.wParam;

				case IDCANCEL:
					EndDialog(hwnd, 0);
				break;
			}
		break;

			case WM_DESTROY:
			DeleteObject(g_hbrBackground);
		  break;

		default:
		return FALSE;
	}
	return TRUE;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case IDM_EXIT:
				DestroyWindow(hwnd);
				break;

				default:
				return FALSE;
			}
		break;	

		case WM_CLOSE:
			DestroyWindow(hwnd);
		break;
		case WM_DESTROY:
			PostQuitMessage(0);
		break;

		default:
		return DefWindowProc(hwnd, msg, wParam, lParam);
	}
	return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
	LPSTR lpCmdLine, int nCmdShow)
{
	WNDCLASSEX wc;
	MSG Msg;

	wc.cbSize		 = sizeof(WNDCLASSEX);
	wc.style		 = 0;
	wc.lpfnWndProc	 = WndProc;
	wc.cbClsExtra	 = 0;
	wc.cbWndExtra	 = 0;
	wc.hInstance	 = hInstance;
	wc.hIcon		 = LoadIcon(NULL, IDI_APPLICATION);
	wc.hCursor		 = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+18);
	wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MENU1);;
	wc.lpszClassName = lpClassName;
	wc.hIconSm		 = LoadIcon(NULL, IDI_APPLICATION);

	RegisterClassEx(&amp;wc);

	hwnd = CreateWindowEx(
		WS_EX_CLIENTEDGE,
		lpClassName,
		&quot;My Window&quot;,
		WS_OVERLAPPEDWINDOW,
		0, 0, 480, 240,
		NULL, NULL, hInstance, NULL);

	return DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIALOG1),hwnd, DlgProc);
}
</code></pre>
<p>edit: sfds</p>
]]></description><link>https://www.c-plusplus.net/forum/post/924979</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/924979</guid><dc:creator><![CDATA[stick_thai]]></dc:creator><pubDate>Wed, 23 Nov 2005 10:49:56 GMT</pubDate></item><item><title><![CDATA[Reply to Erstellen eines normalen Windows mittels Dialog-Button on Wed, 23 Nov 2005 20:22:58 GMT]]></title><description><![CDATA[<p>Vielleicht solltest du besser einen moduslosen Dialog mit <a href="http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/createdialog.asp" rel="nofollow">CreateDialog</a> erstellen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/925683</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/925683</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Wed, 23 Nov 2005 20:22:58 GMT</pubDate></item></channel></rss>