<?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[Wie bekommt man eine Exit Meldung für ein laufendes Program?]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich will sehen, wenn ein Program geschlossen wird ohne dabei FindWindow zu verwenden.<br />
Mir CreateProcess kann ich ein Program starten und bekomme eine PROCESS_INFORMATION struktur, welche ich dann später nach dem Exit Code abfragen<br />
kann (pollen).<br />
Wie bekomme ich diese Struktur von einem bereits laufenden Programm, das nicht mit CreateProcess gestartet wurde.<br />
Bis jetzt habe ich den CWnd* (Findwindow) und die HINSTANCE (PSAPI) von diesem Program.<br />
Aber wie komme ich an die passende PROCESS_INFORMATION für meinen ExitCode?</p>
<p>Grüße<br />
thenoname</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/232576/wie-bekommt-man-eine-exit-meldung-für-ein-laufendes-program</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Apr 2026 10:16:47 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/232576.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 24 Jan 2009 13:15:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Wie bekommt man eine Exit Meldung für ein laufendes Program? on Sat, 24 Jan 2009 13:16:07 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich will sehen, wenn ein Program geschlossen wird ohne dabei FindWindow zu verwenden.<br />
Mir CreateProcess kann ich ein Program starten und bekomme eine PROCESS_INFORMATION struktur, welche ich dann später nach dem Exit Code abfragen<br />
kann (pollen).<br />
Wie bekomme ich diese Struktur von einem bereits laufenden Programm, das nicht mit CreateProcess gestartet wurde.<br />
Bis jetzt habe ich den CWnd* (Findwindow) und die HINSTANCE (PSAPI) von diesem Program.<br />
Aber wie komme ich an die passende PROCESS_INFORMATION für meinen ExitCode?</p>
<p>Grüße<br />
thenoname</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1651381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1651381</guid><dc:creator><![CDATA[thenoname]]></dc:creator><pubDate>Sat, 24 Jan 2009 13:16:07 GMT</pubDate></item><item><title><![CDATA[Reply to Wie bekommt man eine Exit Meldung für ein laufendes Program? on Sat, 24 Jan 2009 13:47:37 GMT]]></title><description><![CDATA[<p>Um ein Prozess-Handle zu bekommen brauchst Du die ProzessId, welcher Du z.B. mittels GetWindowThreadProcessId bekommen kannst.</p>
<p>Warte mittels WaitForSingleObject auf das Prozess-Handle. Liefert dies &quot;WAIT_OBJECT_0&quot; zurück, so wurde der Prozess beendet und Du kannst den Exit-Code abfragen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1651407</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1651407</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sat, 24 Jan 2009 13:47:37 GMT</pubDate></item><item><title><![CDATA[Reply to Wie bekommt man eine Exit Meldung für ein laufendes Program? on Sat, 24 Jan 2009 17:18:16 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe es so gemacht wie du gesagt hast.<br />
Dass das Process Handle funktioniert, sehe ich mit einem GetModuleBaseName<br />
wo ich den Namen der EXE sehe.<br />
Nun mache ich ein</p>
<pre><code>result=WaitForSingleObject(processhandle,100);
</code></pre>
<p>Aber es kommt immer ein &quot;WAIT_FAILED&quot; zurück.</p>
<p>Warum?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1651572</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1651572</guid><dc:creator><![CDATA[thenoname]]></dc:creator><pubDate>Sat, 24 Jan 2009 17:18:16 GMT</pubDate></item><item><title><![CDATA[Reply to Wie bekommt man eine Exit Meldung für ein laufendes Program? on Sat, 24 Jan 2009 17:46:13 GMT]]></title><description><![CDATA[<p>Was sagt GetLastError()?<br />
Vielleicht hat das Handle nicht die nötigen Rechte?</p>
<p>MSDN, OpenProcess schrieb:</p>
<blockquote>
<p>The handle returned by the OpenProcess function can be used in any function that requires a handle to a process, such as the wait functions, <strong>provided the appropriate access rights were requested.</strong></p>
</blockquote>
<p>Für WaitForSingleObject müsstest du auf jeden Fall SYNCHRONIZE anfordern, für GetExitCodeProcess noch PROCESS_QUERY_INFORMATION.<br />
Wenn du Admin-Rechte hast kannst du natürlich PROCESS_ALL_ACCESS versuchen.</p>
<p>Also...</p>
<pre><code class="language-cpp">HANDLE h = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION, false, processID);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1651596</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1651596</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sat, 24 Jan 2009 17:46:13 GMT</pubDate></item><item><title><![CDATA[Reply to Wie bekommt man eine Exit Meldung für ein laufendes Program? on Sun, 25 Jan 2009 22:10:30 GMT]]></title><description><![CDATA[<blockquote>
<p>Für WaitForSingleObject müsstest du auf jeden Fall SYNCHRONIZE anfordern</p>
</blockquote>
<p>Danke, das wars ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1652317</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1652317</guid><dc:creator><![CDATA[thenoname]]></dc:creator><pubDate>Sun, 25 Jan 2009 22:10:30 GMT</pubDate></item></channel></rss>