<?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[bekomme immer ungültigen Handle zurück :(]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich hab da ein grosses Problem und zwar bekomme ich immer von der CreateFile Funktion immer nur einen INVALID_HANDLE_VALUE zurück wenn ich auf COM1 zugreifen möchte. Ich bin schon am verzweifeln woran liegt denn sowas ? und wie kann ich das Problem beheben ?. Hoffe Ihr helft mir weiter.</p>
<p>THX</p>
<p>Euer RMG</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/53966/bekomme-immer-ungültigen-handle-zurück</link><generator>RSS for Node</generator><lastBuildDate>Mon, 01 Jun 2026 14:44:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/53966.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 03 Nov 2003 12:49:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to bekomme immer ungültigen Handle zurück :( on Mon, 03 Nov 2003 12:49:51 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich hab da ein grosses Problem und zwar bekomme ich immer von der CreateFile Funktion immer nur einen INVALID_HANDLE_VALUE zurück wenn ich auf COM1 zugreifen möchte. Ich bin schon am verzweifeln woran liegt denn sowas ? und wie kann ich das Problem beheben ?. Hoffe Ihr helft mir weiter.</p>
<p>THX</p>
<p>Euer RMG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/385614</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/385614</guid><dc:creator><![CDATA[RichardMG]]></dc:creator><pubDate>Mon, 03 Nov 2003 12:49:51 GMT</pubDate></item><item><title><![CDATA[Reply to bekomme immer ungültigen Handle zurück :( on Mon, 03 Nov 2003 20:26:00 GMT]]></title><description><![CDATA[<p>Was sagt den GetLastError() ? Was gibst du für 'nen string als Dateinamen an?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/386053</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/386053</guid><dc:creator><![CDATA[peterchen]]></dc:creator><pubDate>Mon, 03 Nov 2003 20:26:00 GMT</pubDate></item><item><title><![CDATA[Reply to bekomme immer ungültigen Handle zurück :( on Mon, 03 Nov 2003 21:00:42 GMT]]></title><description><![CDATA[<p>GetLastError gibt mir immer eine 6 zurück also ungültiger Handle. Als Sting übergebe ich &quot;COM1&quot;. Woran liegt denn das überhaupt das ich einen ungültigen Handle zurückbekomme denn das mit den ungültigen Handle passier nur ab und zu.</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/386078</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/386078</guid><dc:creator><![CDATA[RichardMG]]></dc:creator><pubDate>Mon, 03 Nov 2003 21:00:42 GMT</pubDate></item><item><title><![CDATA[Reply to bekomme immer ungültigen Handle zurück :( on Mon, 03 Nov 2003 23:22:42 GMT]]></title><description><![CDATA[<p>RichardMG schrieb:</p>
<blockquote>
<p>GetLastError gibt mir immer eine 6 zurück also ungültiger Handle.</p>
</blockquote>
<p>Das kann ich nicht glauben. Du rufst doch bestimmt noch andere Funktionen zwischen CreateFile auf GetLastError auf, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/386197</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/386197</guid><dc:creator><![CDATA[-King-]]></dc:creator><pubDate>Mon, 03 Nov 2003 23:22:42 GMT</pubDate></item><item><title><![CDATA[Reply to bekomme immer ungültigen Handle zurück :( on Tue, 04 Nov 2003 08:12:48 GMT]]></title><description><![CDATA[<p>Du kannst es mir aber glauben GetLastError liefert mir immer nur 6 zurück. Das einzige was ich mache nutze GetCommState dazwischen</p>
<pre><code class="language-cpp">m_hCom = CreateFile(m_pCOMPort, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL , NULL); 
	BOOL handle = GetCommState(m_hCom, &amp;dcb);		// Werte des COM-Ports holen (vorinitialisieren)
	if(!handle)
	{
		int error = GetLastError();
		CString IntToStr, str;
		IntToStr.Format(&quot;%d&quot;, error);
		str = &quot;Zugriff auf COM-Port fehlgeschlagen. \nErrorcode: &quot;+IntToStr+&quot;*&quot;+&quot;\n\n\n* (nur wichtig für den SW-Entwickler)&quot;;
		MessageBox(str, &quot;COM-Port Zugriffsverweigerung&quot;, MB_ICONERROR);
	}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/386305</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/386305</guid><dc:creator><![CDATA[RichardMG]]></dc:creator><pubDate>Tue, 04 Nov 2003 08:12:48 GMT</pubDate></item><item><title><![CDATA[Reply to bekomme immer ungültigen Handle zurück :( on Tue, 04 Nov 2003 10:01:08 GMT]]></title><description><![CDATA[<p>RichardMG schrieb:</p>
<blockquote>
<p>Du kannst es mir aber glauben GetLastError liefert mir immer nur 6 zurück.</p>
</blockquote>
<p>Das habe ich auch nicht in Abrede gestellt. Ich habe nur behauptet, daß das der falsche ErrorCode ist. Und das ist es ja offensichtlich auch.</p>
<p>RichardMG schrieb:</p>
<blockquote>
<p>Das einzige was ich mache nutze GetCommState dazwischen</p>
</blockquote>
<p>Und nun bekommst Du den ErrorCode, den GetCommState setzt. Du hast diese Funktion also mit einem ungültigen Handle aufgerufen. Wenn das Handle von CreateFile nun ungültig ist (CreateFile schlägt fehl), solltest Du mal diesen ErrorCode checken.</p>
<pre><code>m_hCom = CreateFile(...);
if(INVALID_HANDLE_VALUE == m_hCom)
{
    GetLastError();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/386365</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/386365</guid><dc:creator><![CDATA[-King-]]></dc:creator><pubDate>Tue, 04 Nov 2003 10:01:08 GMT</pubDate></item></channel></rss>