<?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[hMutex zu hWND]]></title><description><![CDATA[<p>Quelle: <a href="http://www.bytesandmore.de/rad/index.htm?http://www.bytesandmore.de/rad/cpp/snipp/sc06014.php" rel="nofollow">http://www.bytesandmore.de/rad/index.htm?http://www.bytesandmore.de/rad/cpp/snipp/sc06014.php</a></p>
<p>Ich möchte mein Programm nur einmal starten können. Sollte es schon laufen, soll es in den Vordergrund kommen. Nun habe ich das Problem das ich FindWindow nicht nutzen kann, da sich der Titel ständig ändern kann.</p>
<p>Ich dachte man könnte Handle und HWND gleichsetzen und somit das Problem lösen, das klappte leider nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /><br />
HANDLE hMutex = OpenMutex(MUTEX_ALL_ACCESS, 0, &quot;MeineAnwendung1.0&quot;);<br />
SetForegroundWindow(hMutex);<br />
(Meldet aber auch keinerlei Fehler, klappt nur nicht)</p>
<p>Wie bekomme ich aus dem OpenMutex es hin, das ich dadruch das Fenster in Vordergrund setzen kann? Also ohne das HWND hWnd = FindWindow(0, &quot;FensterTitel&quot;);</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/89437/hmutex-zu-hwnd</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Jul 2026 21:41:10 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/89437.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Oct 2004 16:48:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to hMutex zu hWND on Tue, 19 Oct 2004 16:48:33 GMT]]></title><description><![CDATA[<p>Quelle: <a href="http://www.bytesandmore.de/rad/index.htm?http://www.bytesandmore.de/rad/cpp/snipp/sc06014.php" rel="nofollow">http://www.bytesandmore.de/rad/index.htm?http://www.bytesandmore.de/rad/cpp/snipp/sc06014.php</a></p>
<p>Ich möchte mein Programm nur einmal starten können. Sollte es schon laufen, soll es in den Vordergrund kommen. Nun habe ich das Problem das ich FindWindow nicht nutzen kann, da sich der Titel ständig ändern kann.</p>
<p>Ich dachte man könnte Handle und HWND gleichsetzen und somit das Problem lösen, das klappte leider nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /><br />
HANDLE hMutex = OpenMutex(MUTEX_ALL_ACCESS, 0, &quot;MeineAnwendung1.0&quot;);<br />
SetForegroundWindow(hMutex);<br />
(Meldet aber auch keinerlei Fehler, klappt nur nicht)</p>
<p>Wie bekomme ich aus dem OpenMutex es hin, das ich dadruch das Fenster in Vordergrund setzen kann? Also ohne das HWND hWnd = FindWindow(0, &quot;FensterTitel&quot;);</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/632646</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/632646</guid><dc:creator><![CDATA[nanana]]></dc:creator><pubDate>Tue, 19 Oct 2004 16:48:33 GMT</pubDate></item><item><title><![CDATA[Reply to hMutex zu hWND on Tue, 19 Oct 2004 17:14:45 GMT]]></title><description><![CDATA[<p>Lösung:</p>
<p>HWND hWnd = FindWindowEx(0, 0, &quot;TForm1&quot;, 0);<br />
SetForegroundWindow(hWnd);</p>
<p>TForm1 ist aus<br />
Application-&gt;CreateForm(__classid(TForm1), &amp;Form1);</p>
<p>have fun</p>
]]></description><link>https://www.c-plusplus.net/forum/post/632663</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/632663</guid><dc:creator><![CDATA[BishopOfBorg]]></dc:creator><pubDate>Tue, 19 Oct 2004 17:14:45 GMT</pubDate></item><item><title><![CDATA[Reply to hMutex zu hWND on Tue, 19 Oct 2004 19:05:20 GMT]]></title><description><![CDATA[<p>Ist die Anwendung minimiert oder nur tatsächlich nur im Hintergrund?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/632751</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/632751</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Tue, 19 Oct 2004 19:05:20 GMT</pubDate></item><item><title><![CDATA[Reply to hMutex zu hWND on Wed, 20 Oct 2004 08:28:41 GMT]]></title><description><![CDATA[<p>Bei minimierter Anwendung funktioniert folgendes:</p>
<pre><code class="language-cpp">HANDLE hInstanceMutex = ::CreateMutex(NULL, TRUE, &quot;FP3.MUTEX&quot;);
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
	if (hInstanceMutex)
		CloseHandle(hInstanceMutex);
	Application-&gt;Title = &quot;&quot;;
	HWND hPrevApp = ::FindWindow(NULL, &quot;Fertigungsplanung&quot;);
	if (hPrevApp)
		PostMessage(hPrevApp, WM_SYSCOMMAND, SC_RESTORE, 0);
	return 0;
}
</code></pre>
<p>Edit: Hatte die Code-Tags vergessen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/633032</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/633032</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 20 Oct 2004 08:28:41 GMT</pubDate></item><item><title><![CDATA[Reply to hMutex zu hWND on Wed, 20 Oct 2004 14:28:10 GMT]]></title><description><![CDATA[<p>Danke für den Tip. Ein minimiertes Fenster holte er nicht in den Vordergrund, nun gehts. Allerdings hast du &quot;SetForegroundWindow(hWnd);&quot; vergessen, denn ohne das kommt es nicht nach vorne <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Allerdings lässt sich nun die Anwendung nicht mehr minimieren. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/633401</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/633401</guid><dc:creator><![CDATA[nanana]]></dc:creator><pubDate>Wed, 20 Oct 2004 14:28:10 GMT</pubDate></item><item><title><![CDATA[Reply to hMutex zu hWND on Wed, 20 Oct 2004 14:37:04 GMT]]></title><description><![CDATA[<p>Lösung: <a href="http://www.c-plusplus.net/forum/viewtopic.php?p=373620#373620" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic.php?p=373620#373620</a><br />
(Man muss es natürlich bissle umschreiben, aber dann gehts)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/633404</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/633404</guid><dc:creator><![CDATA[nanana]]></dc:creator><pubDate>Wed, 20 Oct 2004 14:37:04 GMT</pubDate></item></channel></rss>