<?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[WinApi schliesst sich immer]]></title><description><![CDATA[<p>Hallo,</p>
<p>Bringe mir grad das API Programmieren bei, hab aber folgendes Problem:</p>
<p>Alles scheint im quellcode zu stimmen aber wenn ich die Anwendung starte, schliesst sie sich wieder bzw öffnet sich kurz verschwindet aber wieder im Hintergrund.<br />
Im Taskmanager läuft es zwar noch aber ich kanns nicht öffnen.</p>
<p>Der Code:</p>
<pre><code>#include &lt;windows.h&gt;
#include &lt;conio.h&gt;

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	return 0;
}

const char szAppName[]    = &quot;Textausgabe im Anwendungsbereich&quot;;

int WINAPI WinMain(  HINSTANCE hInstance, HINSTANCE hPrevInstance,
                     PSTR szCmdLine, int iCmdShow)
{
   MSG        msg;
   HWND       hWnd;
   WNDCLASS   wc;

   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= szAppName;
   wc.lpszMenuName= NULL;

   RegisterClass(&amp;wc);

   hWnd = CreateWindow(   szAppName,
                          szAppName,
                          WS_OVERLAPPEDWINDOW,
                          CW_USEDEFAULT,
                          CW_USEDEFAULT,
                          CW_USEDEFAULT,
                          CW_USEDEFAULT,
                          NULL,
                          NULL,
                          hInstance,
                          NULL);

   ShowWindow(hWnd, iCmdShow);
   UpdateWindow(hWnd);

   while (GetMessage(&amp;msg, NULL, 0, 0))
   {
      TranslateMessage(&amp;msg);
      DispatchMessage(&amp;msg);
   }
   getch();
   return msg.wParam;
}
</code></pre>
<p>Hoffe mir kann jemand helfen.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/129062/winapi-schliesst-sich-immer</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Jul 2026 00:31:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/129062.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Dec 2005 18:43:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to WinApi schliesst sich immer on Fri, 09 Dec 2005 18:43:54 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Bringe mir grad das API Programmieren bei, hab aber folgendes Problem:</p>
<p>Alles scheint im quellcode zu stimmen aber wenn ich die Anwendung starte, schliesst sie sich wieder bzw öffnet sich kurz verschwindet aber wieder im Hintergrund.<br />
Im Taskmanager läuft es zwar noch aber ich kanns nicht öffnen.</p>
<p>Der Code:</p>
<pre><code>#include &lt;windows.h&gt;
#include &lt;conio.h&gt;

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	return 0;
}

const char szAppName[]    = &quot;Textausgabe im Anwendungsbereich&quot;;

int WINAPI WinMain(  HINSTANCE hInstance, HINSTANCE hPrevInstance,
                     PSTR szCmdLine, int iCmdShow)
{
   MSG        msg;
   HWND       hWnd;
   WNDCLASS   wc;

   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= szAppName;
   wc.lpszMenuName= NULL;

   RegisterClass(&amp;wc);

   hWnd = CreateWindow(   szAppName,
                          szAppName,
                          WS_OVERLAPPEDWINDOW,
                          CW_USEDEFAULT,
                          CW_USEDEFAULT,
                          CW_USEDEFAULT,
                          CW_USEDEFAULT,
                          NULL,
                          NULL,
                          hInstance,
                          NULL);

   ShowWindow(hWnd, iCmdShow);
   UpdateWindow(hWnd);

   while (GetMessage(&amp;msg, NULL, 0, 0))
   {
      TranslateMessage(&amp;msg);
      DispatchMessage(&amp;msg);
   }
   getch();
   return msg.wParam;
}
</code></pre>
<p>Hoffe mir kann jemand helfen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/938384</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/938384</guid><dc:creator><![CDATA[LeeCt]]></dc:creator><pubDate>Fri, 09 Dec 2005 18:43:54 GMT</pubDate></item><item><title><![CDATA[Reply to WinApi schliesst sich immer on Fri, 09 Dec 2005 18:53:15 GMT]]></title><description><![CDATA[<p>Deine WndProc ist aber ziemlich mager, findest du nicht? Einfach mal google nach WinAPI-Tutorial fragen. Dann wirst du jede Menge Beispielcode finden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/938392</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/938392</guid><dc:creator><![CDATA[gruebel]]></dc:creator><pubDate>Fri, 09 Dec 2005 18:53:15 GMT</pubDate></item><item><title><![CDATA[Reply to WinApi schliesst sich immer on Fri, 09 Dec 2005 18:55:00 GMT]]></title><description><![CDATA[<p>Deine Window-Prozedur darf nicht 0 zurück geben, sondern diese Default-Funktion:</p>
<p>return DefWindowProc(hWnd, Message, wParam, lParam);</p>
<p>Gruß</p>
<p>seventh_son</p>
]]></description><link>https://www.c-plusplus.net/forum/post/938393</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/938393</guid><dc:creator><![CDATA[seventh_son]]></dc:creator><pubDate>Fri, 09 Dec 2005 18:55:00 GMT</pubDate></item><item><title><![CDATA[Reply to WinApi schliesst sich immer on Fri, 09 Dec 2005 19:00:12 GMT]]></title><description><![CDATA[<p>AHh thx seventh_son jetzt kalppts <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/938401</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/938401</guid><dc:creator><![CDATA[LeeCt]]></dc:creator><pubDate>Fri, 09 Dec 2005 19:00:12 GMT</pubDate></item></channel></rss>