<?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[Programm schließt aber Prozess bleibt..]]></title><description><![CDATA[<p>OK....Bin neu im Forum also entschuldigung falls Das der Falsche Platz für meine Frage ist...</p>
<p>Ich fange gerade erst an mich mit visual c++ und der winapi zu beschäftigen<br />
Also dachte ich mir Hey, erstell doch erstmal einfach ein leeres Fenster. Gesagt, getan aber wenn ich das leere Fenster wieder schließe geht zwar das Fenster zu, aber der Prozess bleibt und muss manuell im Taskmanager geschlossen werden...<br />
Ist simpel aber ich komm nich drauf was ich falsch mache....<br />
Danke im voraus</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

LRESULT CALLBACK WndProc(HWND window, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
   {
   case WM_DESTROY:
      {
         PostQuitMessage(0);
         return 0;
      }
   }
   return DefWindowProc(window, msg, wParam, lParam);
}

/****************************************************************************************************************************************************************************************/

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
static int xSize=400;
static int ySize=500;
static char klasse[]=&quot;fenster&quot;;

WNDCLASSEX wncx;
HWND window;
MSG msg;

wncx.cbSize=sizeof(wncx);
wncx.style=CS_HREDRAW|CS_VREDRAW;
wncx.lpfnWndProc=WndProc;
wncx.cbClsExtra=0;
wncx.cbWndExtra=0;
wncx.hInstance=hInstance;
wncx.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wncx.hCursor=LoadCursor(NULL,IDC_ARROW);
wncx.hbrBackground=(HBRUSH)GetStockObject(LTGRAY_BRUSH);
wncx.lpszMenuName=0;
wncx.lpszClassName=klasse;
wncx.hIconSm=LoadIcon(NULL,IDI_APPLICATION);

RegisterClassEx(&amp;wncx);

window=CreateWindow(klasse,
					&quot;reaktion&quot;,
					WS_OVERLAPPEDWINDOW^WS_MAXIMIZEBOX^WS_SIZEBOX|WS_VISIBLE,	
					CW_USEDEFAULT,CW_USEDEFAULT,
					xSize,ySize,
					NULL,
					NULL,
					hInstance,
					NULL
					);

ShowWindow(window,nCmdShow);
UpdateWindow(window);

while(GetMessage(&amp;msg,window,0,0))
{
TranslateMessage(&amp;msg);
DispatchMessage(&amp;msg);
}

return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/231655/programm-schließt-aber-prozess-bleibt</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Apr 2026 13:23:51 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/231655.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 13 Jan 2009 21:07:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Programm schließt aber Prozess bleibt.. on Tue, 13 Jan 2009 21:07:42 GMT]]></title><description><![CDATA[<p>OK....Bin neu im Forum also entschuldigung falls Das der Falsche Platz für meine Frage ist...</p>
<p>Ich fange gerade erst an mich mit visual c++ und der winapi zu beschäftigen<br />
Also dachte ich mir Hey, erstell doch erstmal einfach ein leeres Fenster. Gesagt, getan aber wenn ich das leere Fenster wieder schließe geht zwar das Fenster zu, aber der Prozess bleibt und muss manuell im Taskmanager geschlossen werden...<br />
Ist simpel aber ich komm nich drauf was ich falsch mache....<br />
Danke im voraus</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

LRESULT CALLBACK WndProc(HWND window, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
   {
   case WM_DESTROY:
      {
         PostQuitMessage(0);
         return 0;
      }
   }
   return DefWindowProc(window, msg, wParam, lParam);
}

/****************************************************************************************************************************************************************************************/

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
static int xSize=400;
static int ySize=500;
static char klasse[]=&quot;fenster&quot;;

WNDCLASSEX wncx;
HWND window;
MSG msg;

wncx.cbSize=sizeof(wncx);
wncx.style=CS_HREDRAW|CS_VREDRAW;
wncx.lpfnWndProc=WndProc;
wncx.cbClsExtra=0;
wncx.cbWndExtra=0;
wncx.hInstance=hInstance;
wncx.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wncx.hCursor=LoadCursor(NULL,IDC_ARROW);
wncx.hbrBackground=(HBRUSH)GetStockObject(LTGRAY_BRUSH);
wncx.lpszMenuName=0;
wncx.lpszClassName=klasse;
wncx.hIconSm=LoadIcon(NULL,IDI_APPLICATION);

RegisterClassEx(&amp;wncx);

window=CreateWindow(klasse,
					&quot;reaktion&quot;,
					WS_OVERLAPPEDWINDOW^WS_MAXIMIZEBOX^WS_SIZEBOX|WS_VISIBLE,	
					CW_USEDEFAULT,CW_USEDEFAULT,
					xSize,ySize,
					NULL,
					NULL,
					hInstance,
					NULL
					);

ShowWindow(window,nCmdShow);
UpdateWindow(window);

while(GetMessage(&amp;msg,window,0,0))
{
TranslateMessage(&amp;msg);
DispatchMessage(&amp;msg);
}

return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1644917</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1644917</guid><dc:creator><![CDATA[Sorter]]></dc:creator><pubDate>Tue, 13 Jan 2009 21:07:42 GMT</pubDate></item><item><title><![CDATA[Reply to Programm schließt aber Prozess bleibt.. on Tue, 13 Jan 2009 21:18:15 GMT]]></title><description><![CDATA[<p>GetMessage(&amp;msg,window,0,0) wird nich reagieren auf PostQuitMessage weil PostQuitMessage sendet WM_QUIT nach Thread Queue (mit hwnd=0).<br />
Deine GetMessage Funktion erwartet NUR window messages.</p>
<pre><code class="language-cpp">while (GetMessage(&amp;msg,0,0,0))
</code></pre>
<p>oder</p>
<pre><code class="language-cpp">while (IsWindow(window) &amp;&amp; GetMessage(&amp;msg,window,0,0))
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1644920</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1644920</guid><dc:creator><![CDATA[sapero]]></dc:creator><pubDate>Tue, 13 Jan 2009 21:18:15 GMT</pubDate></item><item><title><![CDATA[Reply to Programm schließt aber Prozess bleibt.. on Wed, 14 Jan 2009 19:15:17 GMT]]></title><description><![CDATA[<p>Na bitte, Das wars <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /><br />
Danke für die schnelle Antwort und die Erklärung!<br />
rinnjehustet!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1645642</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1645642</guid><dc:creator><![CDATA[Sorter]]></dc:creator><pubDate>Wed, 14 Jan 2009 19:15:17 GMT</pubDate></item></channel></rss>