<?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[HANDLE an andere Klasse übergeben?]]></title><description><![CDATA[<p>Hi,</p>
<p>ich hab folgendes Problem:</p>
<p>Ich warte in meiner bla.cpp auf das HANDLE bereit:</p>
<p>while(1)<br />
{<br />
dw = WaitForSingleObject(bereit,1000);<br />
if(dw == WAIT_OBJECT_0)<br />
break;<br />
std::cout &lt;&lt; dw &lt;&lt; std::endl;<br />
Sleep(1000);<br />
}</p>
<p>Dieses HANDLE hab ich vorher in bla.cpp erzeugt:</p>
<p>bereit = CreateMutex(NULL,TRUE,NULL);</p>
<p>und übergebe es im Konstruktor der Klasse testexport.<br />
Wenn ich nun im Konstruktor ReleaseMutex(b) aufrufe, so gibt die<br />
WainForSingleObject Funktion ein WAIT_OBJECT_0 zurück und alles ist in Ordnung.<br />
Ich will aber ReleaseMutex(b) in der startMain aufrufen und das Funktioniert nicht. Hab schon alles probiert.<br />
Wenn mir da jemand helfen könnte?</p>
<p>Datei testexport.h</p>
<pre><code>#ifndef _TESTEXPORT_HXX
#define _TESTEXPORT_HXX

#include &lt;windows.h&gt; 

class testexport
{
public: 
	testexport(HANDLE); 
	~testexport(); 
	void startMain(); 
private: 
	HANDLE b; 
};

#endif
</code></pre>
<p>Datei testexport.cpp</p>
<pre><code>#include &lt;iostream&gt; 
#include &quot;testexport.h&quot; 

testexport::testexport(HANDLE be)
{
	//b = OpenMutex(MUTEX_MODIFY_STATE,TRUE,&quot;MutexAuslesen&quot;); 
	b = be; 
	//ReleaseMutex(b); 
}

testexport::~testexport() 
{
}

void testexport::startMain() 
{ 
	ReleaseMutex(b); 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/150442/handle-an-andere-klasse-übergeben</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Jul 2026 17:25:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/150442.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 16 Jun 2006 13:40:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to HANDLE an andere Klasse übergeben? on Fri, 16 Jun 2006 13:40:05 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich hab folgendes Problem:</p>
<p>Ich warte in meiner bla.cpp auf das HANDLE bereit:</p>
<p>while(1)<br />
{<br />
dw = WaitForSingleObject(bereit,1000);<br />
if(dw == WAIT_OBJECT_0)<br />
break;<br />
std::cout &lt;&lt; dw &lt;&lt; std::endl;<br />
Sleep(1000);<br />
}</p>
<p>Dieses HANDLE hab ich vorher in bla.cpp erzeugt:</p>
<p>bereit = CreateMutex(NULL,TRUE,NULL);</p>
<p>und übergebe es im Konstruktor der Klasse testexport.<br />
Wenn ich nun im Konstruktor ReleaseMutex(b) aufrufe, so gibt die<br />
WainForSingleObject Funktion ein WAIT_OBJECT_0 zurück und alles ist in Ordnung.<br />
Ich will aber ReleaseMutex(b) in der startMain aufrufen und das Funktioniert nicht. Hab schon alles probiert.<br />
Wenn mir da jemand helfen könnte?</p>
<p>Datei testexport.h</p>
<pre><code>#ifndef _TESTEXPORT_HXX
#define _TESTEXPORT_HXX

#include &lt;windows.h&gt; 

class testexport
{
public: 
	testexport(HANDLE); 
	~testexport(); 
	void startMain(); 
private: 
	HANDLE b; 
};

#endif
</code></pre>
<p>Datei testexport.cpp</p>
<pre><code>#include &lt;iostream&gt; 
#include &quot;testexport.h&quot; 

testexport::testexport(HANDLE be)
{
	//b = OpenMutex(MUTEX_MODIFY_STATE,TRUE,&quot;MutexAuslesen&quot;); 
	b = be; 
	//ReleaseMutex(b); 
}

testexport::~testexport() 
{
}

void testexport::startMain() 
{ 
	ReleaseMutex(b); 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1078942</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1078942</guid><dc:creator><![CDATA[Winz]]></dc:creator><pubDate>Fri, 16 Jun 2006 13:40:05 GMT</pubDate></item><item><title><![CDATA[Reply to HANDLE an andere Klasse übergeben? on Fri, 16 Jun 2006 14:04:15 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Das gehört bestimmt nicht in das Forum.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1078959</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1078959</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Fri, 16 Jun 2006 14:04:15 GMT</pubDate></item><item><title><![CDATA[Reply to HANDLE an andere Klasse übergeben? on Fri, 16 Jun 2006 14:17:18 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>welches Forum schlägst Du dann vor?<br />
Ich hielt es für das sinnvollste.</p>
<p>Winz!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1078968</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1078968</guid><dc:creator><![CDATA[Winz]]></dc:creator><pubDate>Fri, 16 Jun 2006 14:17:18 GMT</pubDate></item><item><title><![CDATA[Reply to HANDLE an andere Klasse übergeben? on Fri, 16 Jun 2006 14:29:03 GMT]]></title><description><![CDATA[<p>welche fehlermeldung kriegst du von ReleaseMutex?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1078974</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1078974</guid><dc:creator><![CDATA[99]]></dc:creator><pubDate>Fri, 16 Jun 2006 14:29:03 GMT</pubDate></item><item><title><![CDATA[Reply to HANDLE an andere Klasse übergeben? on Fri, 16 Jun 2006 14:40:26 GMT]]></title><description><![CDATA[<p>Ich bekomme keine Fehlermeldung von ReleaseMutex().</p>
<p>Ich habe halt erwartet, dass in beiden erläuterten Fällen die<br />
WainForSingleObjekt-Methode nachdem ReleaseMutex() ausgeführt wurde,<br />
ein WAIT_OBJECT_0 zurückgeben würde.</p>
<p>Ich will ja in meinem Programm erst dann fortfahren, wenn die Methode startMain aus der Klasse testexport ausgeführt wurde.</p>
<p>Winz!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1078984</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1078984</guid><dc:creator><![CDATA[Winz]]></dc:creator><pubDate>Fri, 16 Jun 2006 14:40:26 GMT</pubDate></item><item><title><![CDATA[Reply to HANDLE an andere Klasse übergeben? on Sat, 17 Jun 2006 08:53:41 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=403" rel="nofollow">HumeSikkins</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=4" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1079316</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1079316</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Sat, 17 Jun 2006 08:53:41 GMT</pubDate></item><item><title><![CDATA[Reply to HANDLE an andere Klasse übergeben? on Sat, 17 Jun 2006 14:34:15 GMT]]></title><description><![CDATA[<p>hallo ich habe nicht ganz verstanden kannst du ein fertiges beispiel posten?;,</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1079541</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1079541</guid><dc:creator><![CDATA[Ranner]]></dc:creator><pubDate>Sat, 17 Jun 2006 14:34:15 GMT</pubDate></item><item><title><![CDATA[Reply to HANDLE an andere Klasse übergeben? on Sat, 17 Jun 2006 14:48:31 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Winz schrieb:</p>
<blockquote>
<p>Hi,</p>
<p>welches Forum schlägst Du dann vor?<br />
Ich hielt es für das sinnvollste.</p>
<p>Winz!</p>
</blockquote>
<p>Das wohin es verschoben wurde. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1079545</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1079545</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 17 Jun 2006 14:48:31 GMT</pubDate></item><item><title><![CDATA[Reply to HANDLE an andere Klasse übergeben? on Sat, 17 Jun 2006 15:42:23 GMT]]></title><description><![CDATA[<p>Mach es besser mit Events (CreateEvent/SetEvent). Mutexe machen i.d.R. innerhalb eines Prozesses wenig sinn...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1079582</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1079582</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sat, 17 Jun 2006 15:42:23 GMT</pubDate></item><item><title><![CDATA[Reply to HANDLE an andere Klasse übergeben? on Mon, 19 Jun 2006 12:47:40 GMT]]></title><description><![CDATA[<p>Danke,</p>
<p>ich habs jetzt mit Events ausprobiert und es funktioniert.</p>
<p>Es sollte aber mit Mutexe genauso funktionieren, da ich da ja nichts anderes mache außer das ich statt CreateEvent CreateMutex usw. benutze.</p>
<p>Versteh halt nicht, warum das mit Mutex nicht funktioniert hat.</p>
<p>MfG, Winz!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1080598</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1080598</guid><dc:creator><![CDATA[Winz]]></dc:creator><pubDate>Mon, 19 Jun 2006 12:47:40 GMT</pubDate></item></channel></rss>