<?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 - Fehlercode 1400 ???]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich wollte mir gerade ebend ein Fenster mit der Winapi erzeugen lassen. Allerdings kriege ich beim Aufruf von CreateWindowEx den Fehlercode 1400 (INVALID_WINDOW_HANDLE). Ich habe damit ein Verständnisproblem: CreateWindowEx oder CreateWindow sollen doch genau den erzeugen oder? Wie kann das denn sein bzw. wie kann ich das lösen?</p>
<p>hier der Code:</p>
<pre><code class="language-cpp">HWND CreateMainWindow (HINSTANCE hInstance)
{
	WNDCLASSEX wnd;
	(void)memset (&amp;wnd, 0, sizeof (WNDCLASSEX));

	wnd.cbSize			= sizeof (WNDCLASSEX);
	wnd.hbrBackground	= (HBRUSH) (COLOR_WINDOW + 1);
	wnd.hCursor			= LoadCursor (hInstance, IDC_ARROW);
	wnd.hInstance		= hInstance;
	wnd.hIcon			= LoadIcon (hInstance, IDI_APPLICATION);
	wnd.hIconSm			= LoadIcon (hInstance, IDI_APPLICATION);
	wnd.lpfnWndProc		= MessageHandler;
	wnd.lpszClassName	= &quot;sql&quot;;
	wnd.lpszMenuName	= NULL;
	wnd.style			= CS_OWNDC | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;

	if (!RegisterClassEx (&amp;wnd))
	{
		MessageBox (NULL, ERR_REGISTER, &quot;FATAL ERROR&quot;, 64);
		return NULL;
	}

	hWindow = CreateWindowEx (NULL,
							  &quot;sql&quot;,
							  &quot;sql&quot;, 
							  WS_OVERLAPPEDWINDOW,
							  10,10,
							  640, 480,
							  NULL,
							  NULL,
							  GetModuleHandle (NULL),
							  NULL);

	if (!hWindow)
	{
		int error = GetLastError ();
		MessageBox (NULL, ERR_CREATE, &quot;FATAL ERROR&quot;, 64);
		return NULL;
	}

	return hWindow;
}
</code></pre>
<p>Die Fensterklasse registrieren kann er (RegisterClassEx), allerdings kommt er in den Fall mit GetLastError () rein und liefert 1400 zurück.</p>
<p>Gruß Sebastian</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/94727/createwindowex-fehlercode-1400</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 02:23:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/94727.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 12 Dec 2004 12:39:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CreateWindowEx - Fehlercode 1400 ??? on Sun, 12 Dec 2004 12:39:26 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich wollte mir gerade ebend ein Fenster mit der Winapi erzeugen lassen. Allerdings kriege ich beim Aufruf von CreateWindowEx den Fehlercode 1400 (INVALID_WINDOW_HANDLE). Ich habe damit ein Verständnisproblem: CreateWindowEx oder CreateWindow sollen doch genau den erzeugen oder? Wie kann das denn sein bzw. wie kann ich das lösen?</p>
<p>hier der Code:</p>
<pre><code class="language-cpp">HWND CreateMainWindow (HINSTANCE hInstance)
{
	WNDCLASSEX wnd;
	(void)memset (&amp;wnd, 0, sizeof (WNDCLASSEX));

	wnd.cbSize			= sizeof (WNDCLASSEX);
	wnd.hbrBackground	= (HBRUSH) (COLOR_WINDOW + 1);
	wnd.hCursor			= LoadCursor (hInstance, IDC_ARROW);
	wnd.hInstance		= hInstance;
	wnd.hIcon			= LoadIcon (hInstance, IDI_APPLICATION);
	wnd.hIconSm			= LoadIcon (hInstance, IDI_APPLICATION);
	wnd.lpfnWndProc		= MessageHandler;
	wnd.lpszClassName	= &quot;sql&quot;;
	wnd.lpszMenuName	= NULL;
	wnd.style			= CS_OWNDC | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;

	if (!RegisterClassEx (&amp;wnd))
	{
		MessageBox (NULL, ERR_REGISTER, &quot;FATAL ERROR&quot;, 64);
		return NULL;
	}

	hWindow = CreateWindowEx (NULL,
							  &quot;sql&quot;,
							  &quot;sql&quot;, 
							  WS_OVERLAPPEDWINDOW,
							  10,10,
							  640, 480,
							  NULL,
							  NULL,
							  GetModuleHandle (NULL),
							  NULL);

	if (!hWindow)
	{
		int error = GetLastError ();
		MessageBox (NULL, ERR_CREATE, &quot;FATAL ERROR&quot;, 64);
		return NULL;
	}

	return hWindow;
}
</code></pre>
<p>Die Fensterklasse registrieren kann er (RegisterClassEx), allerdings kommt er in den Fall mit GetLastError () rein und liefert 1400 zurück.</p>
<p>Gruß Sebastian</p>
]]></description><link>https://www.c-plusplus.net/forum/post/671524</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/671524</guid><dc:creator><![CDATA[fluxy]]></dc:creator><pubDate>Sun, 12 Dec 2004 12:39:26 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindowEx - Fehlercode 1400 ??? on Sun, 12 Dec 2004 12:45:02 GMT]]></title><description><![CDATA[<p>Wie sieht MessageHandler aus?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/671527</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/671527</guid><dc:creator><![CDATA[Def.]]></dc:creator><pubDate>Sun, 12 Dec 2004 12:45:02 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindowEx - Fehlercode 1400 ??? on Sun, 12 Dec 2004 12:54:50 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">LRESULT CALLBACK MessageHandler (HWND hWindow, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
		case WM_CREATE:
			break;
		case WM_DESTROY:
			PostQuitMessage (0);
			break;
		case WM_QUIT:
			PostQuitMessage (0);
			break;
		case WM_CLOSE:
			PostQuitMessage (0);
			break;
		default:
			return DefWindowProc (hWindow, message, wParam, lParam);
	}	

	return -1;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/671533</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/671533</guid><dc:creator><![CDATA[fluxy]]></dc:creator><pubDate>Sun, 12 Dec 2004 12:54:50 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindowEx - Fehlercode 1400 ??? on Sun, 12 Dec 2004 12:58:57 GMT]]></title><description><![CDATA[<p>Hmmm ich dachte immer, die Callbackfunktion würde erst nach dem Erstellen des Fensters aufgerufen. Es war wohl das -1 am ende meiner Callbackfunktion. Allerdings so ganz nachvollziehen kann ich das nicht.</p>
<p>Naja es geht auf jedenfall. Danke für den Hinweis.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/671539</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/671539</guid><dc:creator><![CDATA[fluxy]]></dc:creator><pubDate>Sun, 12 Dec 2004 12:58:57 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindowEx - Fehlercode 1400 ??? on Sun, 12 Dec 2004 13:15:34 GMT]]></title><description><![CDATA[<p>Deine Callback-Funktion ist völlig falsch.</p>
<p>1.) Auf WM_CREATE reagierst du durch das break mit -1.</p>
<blockquote>
<p>WM_CREATE</p>
<p>If the application returns –1, the window is destroyed and the CreateWindowEx or CreateWindow function returns a NULL handle.</p>
</blockquote>
<p>2.) Auf WM_QUIT wird nicht in nicht in der Window-Proc ankommen.</p>
<p>3.) Auf WM_CLOSE reagiert man mit DestroyWindow oder EndDialog (bei modalen Dialogen)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/671546</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/671546</guid><dc:creator><![CDATA[-1]]></dc:creator><pubDate>Sun, 12 Dec 2004 13:15:34 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindowEx - Fehlercode 1400 ??? on Sun, 12 Dec 2004 13:32:58 GMT]]></title><description><![CDATA[<blockquote>
<p>2.) Auf WM_QUIT wird nicht in nicht in der Window-Proc ankommen.</p>
<p>3.) Auf WM_CLOSE reagiert man mit DestroyWindow oder EndDialog (bei modalen Dialogen)</p>
</blockquote>
<p>Was willst du?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/671557</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/671557</guid><dc:creator><![CDATA[fluxy]]></dc:creator><pubDate>Sun, 12 Dec 2004 13:32:58 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindowEx - Fehlercode 1400 ??? on Sun, 12 Dec 2004 14:35:46 GMT]]></title><description><![CDATA[<p>Bei 2. hab ich mich wohl ein bisschen verschrieben, aber ich meinte das die WM_QUIT Message nicht in der Window-Proc ankommt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/671571</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/671571</guid><dc:creator><![CDATA[-1]]></dc:creator><pubDate>Sun, 12 Dec 2004 14:35:46 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindowEx - Fehlercode 1400 ??? on Sun, 12 Dec 2004 14:37:05 GMT]]></title><description><![CDATA[<p>Schau dir mal das <a href="http://www.winapi.net/index.php?inhalt=tipp1" rel="nofollow">Gerüst für ein standard Windows-Programm</a> an <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/671601</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/671601</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Sun, 12 Dec 2004 14:37:05 GMT</pubDate></item></channel></rss>