<?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[CreateWindowEx - dwStyle auf WS_MAXIMAZE aber Programm ist beim Start nicht maximiert]]></title><description><![CDATA[<p>Hallo.</p>
<p>Wie der Titel schon sagt habe ich bei CreateWindowEx angegeben, dass das Fenster maximiert initialisiert werden soll, aber wenn ich die fertige EXE aus dem Ordner starte, ist das Fenster leider NICHT maximiert. Komischerweise funtionirt es einwandfrei, wenn ich das Progamm aus der IDE (Code::Blocks) starte. Ich geb' mal den groben Code an, in meinem Programm sind vorwiegend nur noch Kontrollen zum Test der Rückgabewerte eingebaut und es wird verhindert, dass eine zweite Instanz des Programms läuft. Diese Sachen gebe ich jetzt mal nicht an, falls dennoch bedarf sein sollte, kann ich den kompletten Code auch posten (~150 Zeilen).</p>
<pre><code class="language-cpp">int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
	WNDCLASSEX	wc;
	HWND		hwnd;

	MSG		msg;

	ZeroMemory(&amp;wc, sizeof(WNDCLASSEX));
	wc.cbSize		= sizeof(WNDCLASSEX);
	wc.style		= CS_HREDRAW | CS_VREDRAW;
	wc.lpfnWndProc	= main_window_procedure;
	wc.hInstance	= hInstance;
	wc.hbrBackground	= (HBRUSH)(COLOR_WINDOW + 1);
	wc.lpszClassName	= &quot;ClassName&quot;;
         wc.hIcon          = LoadIcon(NULL, IDI_APPLICATION);
         wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
         wc.hIconSm        = LoadIcon(NULL, IDI_APPLICATION);

	RegisterClassEx(&amp;wc);

	hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, &quot;ClassName&quot;, &quot;FileName&quot;,
              WS_MAXIMIZE | WS_OVERLAPPEDWINDOW | WS_VISIBLE, // &lt;- sollte funzen, oder?
              CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, NULL, hInstance, NULL);

	UpdateWindow(hwnd);

	while(GetMessage(&amp;msg, NULL, 0, 0)) {
		TranslateMessage(&amp;msg);
		DispatchMessage(&amp;msg);
	}

	return main_window_message.wParam;
}
</code></pre>
<p>Vielleicht weiss ja jemand Rat?</p>
<p>Ciao.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/234735/createwindowex-dwstyle-auf-ws_maximaze-aber-programm-ist-beim-start-nicht-maximiert</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Apr 2026 17:51:31 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/234735.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 21 Feb 2009 19:03:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CreateWindowEx - dwStyle auf WS_MAXIMAZE aber Programm ist beim Start nicht maximiert on Sat, 21 Feb 2009 19:03:48 GMT]]></title><description><![CDATA[<p>Hallo.</p>
<p>Wie der Titel schon sagt habe ich bei CreateWindowEx angegeben, dass das Fenster maximiert initialisiert werden soll, aber wenn ich die fertige EXE aus dem Ordner starte, ist das Fenster leider NICHT maximiert. Komischerweise funtionirt es einwandfrei, wenn ich das Progamm aus der IDE (Code::Blocks) starte. Ich geb' mal den groben Code an, in meinem Programm sind vorwiegend nur noch Kontrollen zum Test der Rückgabewerte eingebaut und es wird verhindert, dass eine zweite Instanz des Programms läuft. Diese Sachen gebe ich jetzt mal nicht an, falls dennoch bedarf sein sollte, kann ich den kompletten Code auch posten (~150 Zeilen).</p>
<pre><code class="language-cpp">int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
	WNDCLASSEX	wc;
	HWND		hwnd;

	MSG		msg;

	ZeroMemory(&amp;wc, sizeof(WNDCLASSEX));
	wc.cbSize		= sizeof(WNDCLASSEX);
	wc.style		= CS_HREDRAW | CS_VREDRAW;
	wc.lpfnWndProc	= main_window_procedure;
	wc.hInstance	= hInstance;
	wc.hbrBackground	= (HBRUSH)(COLOR_WINDOW + 1);
	wc.lpszClassName	= &quot;ClassName&quot;;
         wc.hIcon          = LoadIcon(NULL, IDI_APPLICATION);
         wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
         wc.hIconSm        = LoadIcon(NULL, IDI_APPLICATION);

	RegisterClassEx(&amp;wc);

	hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, &quot;ClassName&quot;, &quot;FileName&quot;,
              WS_MAXIMIZE | WS_OVERLAPPEDWINDOW | WS_VISIBLE, // &lt;- sollte funzen, oder?
              CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, NULL, hInstance, NULL);

	UpdateWindow(hwnd);

	while(GetMessage(&amp;msg, NULL, 0, 0)) {
		TranslateMessage(&amp;msg);
		DispatchMessage(&amp;msg);
	}

	return main_window_message.wParam;
}
</code></pre>
<p>Vielleicht weiss ja jemand Rat?</p>
<p>Ciao.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1667733</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1667733</guid><dc:creator><![CDATA[Bier]]></dc:creator><pubDate>Sat, 21 Feb 2009 19:03:48 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindowEx - dwStyle auf WS_MAXIMAZE aber Programm ist beim Start nicht maximiert on Sat, 21 Feb 2009 22:12:23 GMT]]></title><description><![CDATA[<p>Bier schrieb:</p>
<blockquote>
<pre><code class="language-cpp">UpdateWindow(hwnd);
</code></pre>
</blockquote>
<p>Batsch davor da mal ein</p>
<pre><code class="language-cpp">ShowWindow(hwnd, SW_MAXIMIZE);
</code></pre>
<p>Warum das aber net bei dir geht weiss ich auch net.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1667828</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1667828</guid><dc:creator><![CDATA[*guggstdu]]></dc:creator><pubDate>Sat, 21 Feb 2009 22:12:23 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindowEx - dwStyle auf WS_MAXIMAZE aber Programm ist beim Start nicht maximiert on Sun, 22 Feb 2009 03:29:37 GMT]]></title><description><![CDATA[<p>So funktioniert's bei mir:</p>
<pre><code class="language-cpp">.
.
.
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, &quot;ClassName&quot;, &quot;Title&quot;, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
                      640, 480, NULL, NULL, hInstance, NULL);

ShowWindow(hwnd, SW_SHOWMAXIMIZED);
UpdateWindow(hwnd);
.
.
.
</code></pre>
<p>Warum es allerdings nicht anders funzt, also ein WS_MAXIMIZE in CreateWindowEx anscheinend überhaupt nicht beachtet wird, ist und bleibt ein Rätsel.</p>
<p>Danke für die recht schnelle Antwort.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1667858</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1667858</guid><dc:creator><![CDATA[Bier]]></dc:creator><pubDate>Sun, 22 Feb 2009 03:29:37 GMT</pubDate></item></channel></rss>