<?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[CreateWindow liefert Error 2?]]></title><description><![CDATA[<p>Hoi,<br />
ich versuch gerade auf meinem Windows Mobile ein Child Fenster zu erstellen, allerdings liefert CreateWindow immer den Error '2' zurück, und ich komm einfach nicht darauf, warum.</p>
<pre><code class="language-cpp">WNDCLASS wc;
	wc.style         = CS_HREDRAW | CS_VREDRAW;
	wc.lpfnWndProc   = TouchPadProc;
	wc.cbClsExtra    = 0;
	wc.cbWndExtra    = 0;
	wc.hInstance     = hInstance;
	wc.hIcon         =0;
	wc.hCursor       = 0;
	wc.hbrBackground       = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
	wc.lpszMenuName  = 0;
	wc.lpszClassName = szpad;

	if(!RegisterClass(&amp;wc))
	{
		MessageBox(hWnd,L&quot;Fehler&quot;,0,0);
	}

.....
...
..
g_hwnd_Pad = CreateWindow( szpad,
				0,
				WS_CHILD | WS_VISIBLE | WS_DLGFRAME,
				10,
				50,
				50,
				50,
				hWnd,
				NULL,
				g_hInst,
				NULL);
			 if(!g_hwnd_Pad)
			 {
				 int nError = GetLastError();
				 wchar_t szError[] = L&quot;__________&quot;;
				swprintf(szError,L&quot;%d&quot;,nError);
				 MessageBox(hWnd,szError,0,0);
			 }
</code></pre>
<p>Wär schön, wenn mir wer helfen könnte, thx.</p>
<p>PS: Das ganze soll eine Art Touchpad werden, also quasi ein eigenes Steuerelement, wie ein Button. Bin ich da richt, wenn ich ein eigenes Steuerelement so 'erfinden' will, oder soll ich das anders machen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/202986/createwindow-liefert-error-2</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Apr 2026 07:37:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/202986.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 17 Jan 2008 15:34:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CreateWindow liefert Error 2? on Thu, 17 Jan 2008 15:34:09 GMT]]></title><description><![CDATA[<p>Hoi,<br />
ich versuch gerade auf meinem Windows Mobile ein Child Fenster zu erstellen, allerdings liefert CreateWindow immer den Error '2' zurück, und ich komm einfach nicht darauf, warum.</p>
<pre><code class="language-cpp">WNDCLASS wc;
	wc.style         = CS_HREDRAW | CS_VREDRAW;
	wc.lpfnWndProc   = TouchPadProc;
	wc.cbClsExtra    = 0;
	wc.cbWndExtra    = 0;
	wc.hInstance     = hInstance;
	wc.hIcon         =0;
	wc.hCursor       = 0;
	wc.hbrBackground       = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
	wc.lpszMenuName  = 0;
	wc.lpszClassName = szpad;

	if(!RegisterClass(&amp;wc))
	{
		MessageBox(hWnd,L&quot;Fehler&quot;,0,0);
	}

.....
...
..
g_hwnd_Pad = CreateWindow( szpad,
				0,
				WS_CHILD | WS_VISIBLE | WS_DLGFRAME,
				10,
				50,
				50,
				50,
				hWnd,
				NULL,
				g_hInst,
				NULL);
			 if(!g_hwnd_Pad)
			 {
				 int nError = GetLastError();
				 wchar_t szError[] = L&quot;__________&quot;;
				swprintf(szError,L&quot;%d&quot;,nError);
				 MessageBox(hWnd,szError,0,0);
			 }
</code></pre>
<p>Wär schön, wenn mir wer helfen könnte, thx.</p>
<p>PS: Das ganze soll eine Art Touchpad werden, also quasi ein eigenes Steuerelement, wie ein Button. Bin ich da richt, wenn ich ein eigenes Steuerelement so 'erfinden' will, oder soll ich das anders machen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1438500</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1438500</guid><dc:creator><![CDATA[Minumi]]></dc:creator><pubDate>Thu, 17 Jan 2008 15:34:09 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindow liefert Error 2? on Thu, 17 Jan 2008 15:46:37 GMT]]></title><description><![CDATA[<p>lpszMenuName ist ein Zeiger auf einen String. Du gibst aber einen Integer (0) an.<br />
Bei wc.hCursor und wc.hIcon muß ein gültiges Handle stehen. Einfach 0 geht nicht.<br />
wc.cbSize hast Du vergessen.</p>
<pre><code>Windlcass wc;
   wc.cbSize        =  sizeof(WNDCLASSEX);
   wc.style         =  CS_HREDRAW | CS_VREDRAW;
   wc.lpfnWndProc   =  WndProc;
   wc.cbClsExtra    =  0;
   wc.cbWndExtra    =  0;
   wc.hInstance     =  hInstance;
   wc.hCursor       =  LoadCursor(NULL,IDC_ARROW);
   wc.hIcon         =  LoadIcon(NULL, IDI_APPLICATION);
   wc.hbrBackground =  (HBRUSH)GetStockObject(WHITE_BRUSH);
   wc.lpszClassName =  lpszAppName;
   wc.lpszMenuName  =  lpszAppName;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1438512</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1438512</guid><dc:creator><![CDATA[Elektronix]]></dc:creator><pubDate>Thu, 17 Jan 2008 15:46:37 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindow liefert Error 2? on Thu, 17 Jan 2008 16:04:52 GMT]]></title><description><![CDATA[<p>Das ganze hab ich eigentlich fast 1:1 von meinem Parentwindow übernommen, und das funktioniert ja. cbSize gibts bei mir gar nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1438529</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1438529</guid><dc:creator><![CDATA[Minumi]]></dc:creator><pubDate>Thu, 17 Jan 2008 16:04:52 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindow liefert Error 2? on Mon, 21 Jan 2008 08:13:32 GMT]]></title><description><![CDATA[<p>cbSize muß aber dabei sein, damit Windows weiß, wievliel Speicher es reservieren muß.<br />
Außerdem: Bei einem Child-Window wird in CreateWindow als hInstance nicht einfach hInstance angegeben, sondern ((LPCREATESTRUCT)lParam)-&gt;hInstance (Verweis auf die hInstance des Parent-Windows).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1440318</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1440318</guid><dc:creator><![CDATA[Elektronix]]></dc:creator><pubDate>Mon, 21 Jan 2008 08:13:32 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindow liefert Error 2? on Mon, 21 Jan 2008 09:22:10 GMT]]></title><description><![CDATA[<p>Elektronix schrieb:</p>
<blockquote>
<p>cbSize muß aber dabei sein, damit Windows weiß, wievliel Speicher es reservieren muß.</p>
</blockquote>
<p>WNDCLASS hat einen cbSize Member!</p>
<p>Elektronix schrieb:</p>
<blockquote>
<p>Außerdem: Bei einem Child-Window wird in CreateWindow als hInstance nicht einfach hInstance angegeben, sondern ((LPCREATESTRUCT)lParam)-&gt;hInstance (Verweis auf die hInstance des Parent-Windows).</p>
</blockquote>
<p>Falsch: Man gibt das hInstance an, dass die entsprechende Fensterklasse registriert hat bzw. hostet. Wenn ds Kindfenster durch eine DLL gehostet wird, muss deren hInstance angegeben werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1440384</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1440384</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Mon, 21 Jan 2008 09:22:10 GMT</pubDate></item><item><title><![CDATA[Reply to CreateWindow liefert Error 2? on Mon, 21 Jan 2008 10:23:52 GMT]]></title><description><![CDATA[<p>Martin Richter schrieb:</p>
<blockquote>
<p>Man gibt das hInstance an, dass die entsprechende Fensterklasse registriert hat bzw. hostet. Wenn ds Kindfenster durch eine DLL gehostet wird, muss deren hInstance angegeben werden.</p>
</blockquote>
<p>Ja, genaugenommen schon. Aber er hat ja das Parent nicht in ner DLL, sondern selbst getippt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1440437</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1440437</guid><dc:creator><![CDATA[Elektronix]]></dc:creator><pubDate>Mon, 21 Jan 2008 10:23:52 GMT</pubDate></item></channel></rss>