<?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[[Newb]: CreateWindowEx liefert 0 zurück]]></title><description><![CDATA[<p>Ich hab mir, zum vereinfachen eine Klasse geschrieben:</p>
<pre><code class="language-cpp">LRESULT CALLBACK Shice_Handler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
	switch(msg)
	{
		case WM_DESTROY:
		{
			PostQuitMessage(0);
			return 0;
		}
	}
	return DefWindowProc(hwnd, msg, wparam, lparam);
}

class Shice
{
protected:
	LPDIRECT3D9 lpD3D;
	HWND window;
	LPDIRECT3DDEVICE9 device;

	void InitD3D();

public:
	class Exception
	{
	protected:
		std::string msg;
	public:
		const char* getmsg(){return msg.c_str();}
		Exception(std::string param)
		{
			msg = param;
		}
	};

	struct WindowOptions
	{
		LPCTSTR MenuName;
		LPCTSTR ClassName;
		HICON Icon;
		HCURSOR Cursor;
		HBRUSH Color;
		int width, height;
		LPCTSTR Text;
		LPCTSTR Over;
	};

protected:
	void CreateMainWindow(HINSTANCE hinst, WindowOptions options);

public:
	Shice(HINSTANCE hinst)
	{
		WindowOptions options;
		options.ClassName = &quot;Shittest&quot;;
		options.Color = (HBRUSH)GetStockObject(WHITE_BRUSH);
		options.Cursor = LoadCursor(0, IDC_ARROW);
		options.Icon = LoadIcon(0, IDI_APPLICATION);
		options.MenuName = 0;
		options.width = 800;
		options.height = 600;
		options.Text = &quot;Shicetest&quot;;
		options.Over = &quot;Oben?&quot;; 

		try
		{
			CreateMainWindow(hinst, options);
		}
		catch(Shice::Exception&amp; ex){MessageBox(0, ex.getmsg(), &quot;Fehler&quot;, MB_OK | MB_ICONEXCLAMATION);}

	}
	~Shice()
	{
		//device-&gt;Release(); lpD3D-&gt;Release();
	}
};

void Shice::CreateMainWindow(HINSTANCE hinst, WindowOptions options)
{
	WNDCLASSEX wcx;
	wcx.cbSize = sizeof(wcx);
	wcx.lpszClassName = options.ClassName;
	wcx.lpfnWndProc = Shice_Handler;
	wcx.style = CS_HREDRAW | CS_VREDRAW;
	wcx.hInstance = hinst;
	wcx.hIcon = options.Icon;
	wcx.hCursor = options.Cursor;
	wcx.hIconSm = options.Icon;
	wcx.hbrBackground = options.Color;
	wcx.lpszMenuName = options.MenuName;
	wcx.cbClsExtra = 0;
	wcx.cbWndExtra = 0;

	if(!RegisterClassEx(&amp;wcx))
	{
		throw Exception(&quot;Fenster konnte nicht registriert werden&quot;);
	}
	window = CreateWindowEx(0, options.Text, options.Over, WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 
		                    options.width, options.height, 0, 0, hinst, 0);
	if(!window)
	{
		throw Exception(&quot;Fenster konnte nicht erzeugt werden&quot;);
	}	
}
</code></pre>
<p>Dann kommt die Nachricht, dass das Fenster nicht erzeugt werden konnte, warum nicht? Wie finde ichs heraus? UNd warum kann VC++ die .exe nach dem ersten kompilieren nicht mehr öffnen und ich muss mich dauernd an- und wieder abmelden?</p>
<p>thx im voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/76321/newb-createwindowex-liefert-0-zurück</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 10:20:21 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/76321.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 09 Jun 2004 20:27:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [Newb]: CreateWindowEx liefert 0 zurück on Wed, 09 Jun 2004 20:27:15 GMT]]></title><description><![CDATA[<p>Ich hab mir, zum vereinfachen eine Klasse geschrieben:</p>
<pre><code class="language-cpp">LRESULT CALLBACK Shice_Handler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
	switch(msg)
	{
		case WM_DESTROY:
		{
			PostQuitMessage(0);
			return 0;
		}
	}
	return DefWindowProc(hwnd, msg, wparam, lparam);
}

class Shice
{
protected:
	LPDIRECT3D9 lpD3D;
	HWND window;
	LPDIRECT3DDEVICE9 device;

	void InitD3D();

public:
	class Exception
	{
	protected:
		std::string msg;
	public:
		const char* getmsg(){return msg.c_str();}
		Exception(std::string param)
		{
			msg = param;
		}
	};

	struct WindowOptions
	{
		LPCTSTR MenuName;
		LPCTSTR ClassName;
		HICON Icon;
		HCURSOR Cursor;
		HBRUSH Color;
		int width, height;
		LPCTSTR Text;
		LPCTSTR Over;
	};

protected:
	void CreateMainWindow(HINSTANCE hinst, WindowOptions options);

public:
	Shice(HINSTANCE hinst)
	{
		WindowOptions options;
		options.ClassName = &quot;Shittest&quot;;
		options.Color = (HBRUSH)GetStockObject(WHITE_BRUSH);
		options.Cursor = LoadCursor(0, IDC_ARROW);
		options.Icon = LoadIcon(0, IDI_APPLICATION);
		options.MenuName = 0;
		options.width = 800;
		options.height = 600;
		options.Text = &quot;Shicetest&quot;;
		options.Over = &quot;Oben?&quot;; 

		try
		{
			CreateMainWindow(hinst, options);
		}
		catch(Shice::Exception&amp; ex){MessageBox(0, ex.getmsg(), &quot;Fehler&quot;, MB_OK | MB_ICONEXCLAMATION);}

	}
	~Shice()
	{
		//device-&gt;Release(); lpD3D-&gt;Release();
	}
};

void Shice::CreateMainWindow(HINSTANCE hinst, WindowOptions options)
{
	WNDCLASSEX wcx;
	wcx.cbSize = sizeof(wcx);
	wcx.lpszClassName = options.ClassName;
	wcx.lpfnWndProc = Shice_Handler;
	wcx.style = CS_HREDRAW | CS_VREDRAW;
	wcx.hInstance = hinst;
	wcx.hIcon = options.Icon;
	wcx.hCursor = options.Cursor;
	wcx.hIconSm = options.Icon;
	wcx.hbrBackground = options.Color;
	wcx.lpszMenuName = options.MenuName;
	wcx.cbClsExtra = 0;
	wcx.cbWndExtra = 0;

	if(!RegisterClassEx(&amp;wcx))
	{
		throw Exception(&quot;Fenster konnte nicht registriert werden&quot;);
	}
	window = CreateWindowEx(0, options.Text, options.Over, WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 
		                    options.width, options.height, 0, 0, hinst, 0);
	if(!window)
	{
		throw Exception(&quot;Fenster konnte nicht erzeugt werden&quot;);
	}	
}
</code></pre>
<p>Dann kommt die Nachricht, dass das Fenster nicht erzeugt werden konnte, warum nicht? Wie finde ichs heraus? UNd warum kann VC++ die .exe nach dem ersten kompilieren nicht mehr öffnen und ich muss mich dauernd an- und wieder abmelden?</p>
<p>thx im voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/537090</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/537090</guid><dc:creator><![CDATA[Glamdrink]]></dc:creator><pubDate>Wed, 09 Jun 2004 20:27:15 GMT</pubDate></item><item><title><![CDATA[Reply to [Newb]: CreateWindowEx liefert 0 zurück on Wed, 09 Jun 2004 21:12:21 GMT]]></title><description><![CDATA[<p>Könntest du mal deinen Code auf das wesentliche minimieren? Also ohne die ganze Shice-Klasse. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/537123</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/537123</guid><dc:creator><![CDATA[:DDDD]]></dc:creator><pubDate>Wed, 09 Jun 2004 21:12:21 GMT</pubDate></item><item><title><![CDATA[Reply to [Newb]: CreateWindowEx liefert 0 zurück on Wed, 09 Jun 2004 21:16:46 GMT]]></title><description><![CDATA[<p>Wenn man bei CreateWindowEx options.Text durch &quot;Shittest&quot; ersetzt funktioniert es.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/537126</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/537126</guid><dc:creator><![CDATA[:::DDDDDDDD]]></dc:creator><pubDate>Wed, 09 Jun 2004 21:16:46 GMT</pubDate></item><item><title><![CDATA[Reply to [Newb]: CreateWindowEx liefert 0 zurück on Wed, 09 Jun 2004 21:17:58 GMT]]></title><description><![CDATA[<p>Du solltest es also durch options.ClassName ersetzen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/537128</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/537128</guid><dc:creator><![CDATA[:DDDDDDDDDDDDD]]></dc:creator><pubDate>Wed, 09 Jun 2004 21:17:58 GMT</pubDate></item><item><title><![CDATA[Reply to [Newb]: CreateWindowEx liefert 0 zurück on Wed, 09 Jun 2004 21:19:02 GMT]]></title><description><![CDATA[<p>:DDDDDDDDDDDDD schrieb:</p>
<blockquote>
<p>Du solltest es also durch options.ClassName ersetzen</p>
</blockquote>
<p>Das wollte ich auch gerade empfehlen <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/537130</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/537130</guid><dc:creator><![CDATA[Aziz]]></dc:creator><pubDate>Wed, 09 Jun 2004 21:19:02 GMT</pubDate></item><item><title><![CDATA[Reply to [Newb]: CreateWindowEx liefert 0 zurück on Wed, 09 Jun 2004 21:22:58 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Glamdrink schrieb:</p>
<blockquote>
<p>UNd warum kann VC++ die .exe nach dem ersten kompilieren nicht mehr öffnen und ich muss mich dauernd an- und wieder abmelden</p>
</blockquote>
<p>Ich denke mal, dass die Exe noch läuft. Einfach mal im Taskmanager nachschauen.</p>
<p>MfG<br />
tuküe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/537131</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/537131</guid><dc:creator><![CDATA[tuküe]]></dc:creator><pubDate>Wed, 09 Jun 2004 21:22:58 GMT</pubDate></item><item><title><![CDATA[Reply to [Newb]: CreateWindowEx liefert 0 zurück on Wed, 09 Jun 2004 21:31:20 GMT]]></title><description><![CDATA[<blockquote>
<p>UNd warum kann VC++ die .exe nach dem ersten kompilieren nicht mehr öffnen und ich muss mich dauernd an- und wieder abmelden</p>
</blockquote>
<p>Dafür solltest du mal den Rest des Codes zeigen. Du hast ja noch nicht mal die WinMain geliefert. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/537136</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/537136</guid><dc:creator><![CDATA[die!!!]]></dc:creator><pubDate>Wed, 09 Jun 2004 21:31:20 GMT</pubDate></item></channel></rss>