<?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[Kann kein Fenster erstellen]]></title><description><![CDATA[<p>N'Abend,</p>
<p>Bin mit dem Konsolen-Experte unterwegs und versuche gerade ein Windows-Fenster zu basteln. Dabei benutze ich folgenden Befehl:</p>
<pre><code>if (!(hwnd = CreateWindowEx(NULL,
                szclassname,
                &quot;Mein Fenster&quot;,
                WS_POPUP | WS_VISIBLE,
                0,0,
                400,300,
                NULL,
                NULL,
                hinst,
                NULL))) {
      MessageBox(hwnd, &quot;Fehler&quot;, &quot;XXX&quot;, MB_OK);
      return(0);
   }
</code></pre>
<p>Erstens, spuckt mir der Borland Builder 6 eine Fehlermeldung aus, zweitens wird beim ausführen die Fehlermeldung ausgespuckt.</p>
<p>Was mache ich hier falsch. Danke für eure Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/97794/kann-kein-fenster-erstellen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Jul 2026 21:59:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/97794.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 13 Jan 2005 19:38:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Kann kein Fenster erstellen on Thu, 13 Jan 2005 19:38:29 GMT]]></title><description><![CDATA[<p>N'Abend,</p>
<p>Bin mit dem Konsolen-Experte unterwegs und versuche gerade ein Windows-Fenster zu basteln. Dabei benutze ich folgenden Befehl:</p>
<pre><code>if (!(hwnd = CreateWindowEx(NULL,
                szclassname,
                &quot;Mein Fenster&quot;,
                WS_POPUP | WS_VISIBLE,
                0,0,
                400,300,
                NULL,
                NULL,
                hinst,
                NULL))) {
      MessageBox(hwnd, &quot;Fehler&quot;, &quot;XXX&quot;, MB_OK);
      return(0);
   }
</code></pre>
<p>Erstens, spuckt mir der Borland Builder 6 eine Fehlermeldung aus, zweitens wird beim ausführen die Fehlermeldung ausgespuckt.</p>
<p>Was mache ich hier falsch. Danke für eure Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/695495</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/695495</guid><dc:creator><![CDATA[Bin_Gast]]></dc:creator><pubDate>Thu, 13 Jan 2005 19:38:29 GMT</pubDate></item><item><title><![CDATA[Reply to Kann kein Fenster erstellen on Thu, 13 Jan 2005 19:42:37 GMT]]></title><description><![CDATA[<p>Muss mich etwas korrigieren. Ist keine Fehlermeldung sondern nur eine Warnung, die da lautet:</p>
<p>[C++ Warning] Unit1.cpp(78): W8060 Possibly incorrect assignment</p>
<p>Schön, dass er mich darauf hinweißt. Wie geht es dann richtig?</p>
<p>Thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/695501</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/695501</guid><dc:creator><![CDATA[Bin_Gast]]></dc:creator><pubDate>Thu, 13 Jan 2005 19:42:37 GMT</pubDate></item><item><title><![CDATA[Reply to Kann kein Fenster erstellen on Thu, 13 Jan 2005 19:57:45 GMT]]></title><description><![CDATA[<p>Der Compiler weist dich lediglich nochmal auf die Verwechslungsgefahr zwischen '=' und '==' hin, in if-Abfragen wird in der Regel ja der Vergleichsoperator verwendet.<br />
Wenn du die Warnung vermeiden willst dann schreibe unmissverständlichen Code.</p>
<pre><code class="language-cpp">hwnd = CreateWindowEx(...);
if (!hwnd)
  MessageBox(...);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/695514</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/695514</guid><dc:creator><![CDATA[Jansen]]></dc:creator><pubDate>Thu, 13 Jan 2005 19:57:45 GMT</pubDate></item><item><title><![CDATA[Reply to Kann kein Fenster erstellen on Thu, 13 Jan 2005 20:10:46 GMT]]></title><description><![CDATA[<p>Gut, habe den Quelltext jetzt soweit abgeändert, dass keine Warnung mehr vorhanden ist, dank an Jansen. Trotzdem kann ich kein Fenster erzeugen. Sobald ich das Programm ausführe, wird eine Messagebox angezeigt.</p>
<p>Hier der geänderte Quelltext:</p>
<pre><code>hwnd = CreateWindowEx(NULL, szclassname, &quot;Mein Fenster&quot;, WS_POPUP | WS_VISIBLE,
                0,0,400,300, NULL, NULL, hinst, NULL);
   if (!hwnd) {
      MessageBox(hwnd, &quot;Das Fenster wurde nicht erstellt!&quot;, &quot;Fehler!&quot;, MB_OK);
      return(0);
   }
</code></pre>
<p>Nun wird die MessageBox &quot;Das Fenster konnte nicht erstellt werden!&quot; ausgegeben. D.h., die Funktion CreateWindowEx(...) funzt nicht und liefert kein HWND zurück sondern NULL. Woran liegt das schon wieder? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/695536</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/695536</guid><dc:creator><![CDATA[smetsys]]></dc:creator><pubDate>Thu, 13 Jan 2005 20:10:46 GMT</pubDate></item><item><title><![CDATA[Reply to Kann kein Fenster erstellen on Thu, 13 Jan 2005 20:17:01 GMT]]></title><description><![CDATA[<p>Hier der Quelltext von Beginn an, vielleicht mach ich da etwas falsch?</p>
<pre><code>WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprevinst,
					    LPSTR lpcmdline, int ncmdshow) {
   WNDCLASSEX  winclass;
   MSG	      message;
   const char  szclassname[] = &quot;Drawing&quot;;
   DWORD       loop_start_time;

   winclass.cbSize         = sizeof(WNDCLASSEX);
   winclass.style	         = CS_HREDRAW | CS_VREDRAW;
   winclass.lpfnWndProc	= WindowProc;
   winclass.cbClsExtra	= 0;
   winclass.cbWndExtra	= 0;
   winclass.hInstance	= hinst;
   winclass.hIcon	         = LoadIcon(NULL, IDI_APPLICATION);
   winclass.hCursor	= LoadCursor(NULL, IDC_ARROW);
   winclass.hbrBackground  = (HBRUSH)GetStockObject(WHITE_BRUSH);
   winclass.lpszMenuName   = NULL;
   winclass.lpszClassName  = szclassname;
   winclass.hIconSm        = LoadIcon(NULL, IDI_APPLICATION);

   if (!RegisterClassEx(&amp;winclass))
   	return(0);
   hwnd = CreateWindowEx(NULL, szclassname, &quot;Mein Fenster&quot;, WS_POPUP | WS_VISIBLE,
                0,0,400,300, NULL, NULL, hinst, NULL);
   if (!hwnd) {
      MessageBox(hwnd, &quot;Das Fenster wurde nicht erstellt!&quot;, &quot;Fehler!&quot;, MB_OK);
      return(0);
   }

...
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/695541</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/695541</guid><dc:creator><![CDATA[smetsys]]></dc:creator><pubDate>Thu, 13 Jan 2005 20:17:01 GMT</pubDate></item><item><title><![CDATA[Reply to Kann kein Fenster erstellen on Thu, 13 Jan 2005 20:55:18 GMT]]></title><description><![CDATA[<p>Hab den Fehler gefunden. Lag nicht an der WinMain-Methode, sondern an der Callback-Funktion. Hat sich damit jetzt alles erledigt.</p>
<p>Danke für die Mühe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/695604</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/695604</guid><dc:creator><![CDATA[smetsys]]></dc:creator><pubDate>Thu, 13 Jan 2005 20:55:18 GMT</pubDate></item></channel></rss>