<?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[WaitCommEvent Problem: GetLastError() sagt: Überlappender E&#x2F;A Vorgang wird bearbeitet]]></title><description><![CDATA[<p>hi leute!<br />
ich versuche grad WaitCommEvent zum laufen zu bringen....</p>
<p>in der MSDN steht folgendes:<br />
- If the function succeeds, the return value is nonzero.<br />
- If the function fails, the return value is zero. To get extended error information, call GetLastError.</p>
<p>irgendwie bekomme ich bei WaitCommEvent immer 0 als Returnwert!!?? ich versteh das nicht...<br />
hab GetLastError ausgeben lassen:<br />
Überlappender E/A Vorgang wird bearbeitet</p>
<p>vielleicht weiß jemand um rat!? code siehe unten...</p>
<p>mfg nike.</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;

void main(void)
{
	HANDLE h_COM;					// Handle to COM
	DCB dcb;					// Device Control Block
	DWORD dw_Ret;					// Return Value
	OVERLAPPED o = {0,0,0,0,NULL};			// Overlapped Structure
	HANDLE h_Event;					// Handle to Event
	char c_Buffer[100] = {&quot;Hallo&quot;};			// Send/Receive Buffer

	// Open COM1 in Overlapped I/O Mode
	h_COM = CreateFile(&quot;COM1&quot;,		// Name
		GENERIC_READ|GENERIC_WRITE, 	// Access mode
		0,				// Share Mode = not shared
		NULL,				// Security
		OPEN_EXISTING,			// Open existing
		FILE_FLAG_OVERLAPPED,		// File settings
		NULL);

	// Get the current COM1 settings
	GetCommState(h_COM, &amp;dcb);

	// Change the current COM1 settings
	dcb.BaudRate = CBR_115200;		// 115200 bits per second
	dcb.ByteSize = 8;			// 8 bit per byte
	dcb.Parity = 1;				// odd parity
	dcb.StopBits = 0;			// 1 stop bit

	// Set the new COM1 settings
	SetCommState(h_COM, &amp;dcb);

	// Set COM1 Event Mask
	SetCommMask(h_COM,			// Handle to COM
		EV_RXCHAR);			// Set Event if character receive

	// Create a new event
	h_Event = CreateEvent(NULL,		// Security Attributes
		FALSE,				// Auto Reset
		FALSE,				// Initial State
		NULL);				// Name

	// Assign event to overlapped structure
	o.hEvent = h_Event;

	// Wait for event to happen
	if(!WaitCommEvent(h_COM, &amp;dw_Ret,&amp;o))
        {
		LPTSTR pMessageBuffer;

		::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
				NULL,
				::GetLastError(),
				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
				reinterpret_cast&lt;LPTSTR&gt;(&amp;pMessageBuffer),
				0,
				NULL);

		std::string errorMessage(pMessageBuffer);

		cout &lt;&lt; errorMessage.c_str() &lt;&lt; endl;
        }	

	// Perform overloapped read operation 
	// ReadFile immediatly returns        
	ReadFile(h_COM,					// Handle to COM
		&amp;c_Buffer,				// Buffer to receive
		1,					// # Bytes to receive
		&amp;dw_Ret,				// Bytes transferred
		&amp;o);					// Overlapped structure

	// Wait for read operation to be finished	
	GetOverlappedResult(h_COM,			// Handle to COM
		&amp;o,					// Overlapped structure
		&amp;dw_Ret,				// Bytes transferred
		TRUE);					// WAIT flag

	// Close COM1
	CloseHandle(h_COM);				// Close COM Resource

	// Close event
	CloseHandle(h_Event);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/93613/waitcommevent-problem-getlasterror-sagt-überlappender-e-a-vorgang-wird-bearbeitet</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 09:11:35 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/93613.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 01 Dec 2004 00:25:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to WaitCommEvent Problem: GetLastError() sagt: Überlappender E&#x2F;A Vorgang wird bearbeitet on Wed, 01 Dec 2004 00:25:55 GMT]]></title><description><![CDATA[<p>hi leute!<br />
ich versuche grad WaitCommEvent zum laufen zu bringen....</p>
<p>in der MSDN steht folgendes:<br />
- If the function succeeds, the return value is nonzero.<br />
- If the function fails, the return value is zero. To get extended error information, call GetLastError.</p>
<p>irgendwie bekomme ich bei WaitCommEvent immer 0 als Returnwert!!?? ich versteh das nicht...<br />
hab GetLastError ausgeben lassen:<br />
Überlappender E/A Vorgang wird bearbeitet</p>
<p>vielleicht weiß jemand um rat!? code siehe unten...</p>
<p>mfg nike.</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;

void main(void)
{
	HANDLE h_COM;					// Handle to COM
	DCB dcb;					// Device Control Block
	DWORD dw_Ret;					// Return Value
	OVERLAPPED o = {0,0,0,0,NULL};			// Overlapped Structure
	HANDLE h_Event;					// Handle to Event
	char c_Buffer[100] = {&quot;Hallo&quot;};			// Send/Receive Buffer

	// Open COM1 in Overlapped I/O Mode
	h_COM = CreateFile(&quot;COM1&quot;,		// Name
		GENERIC_READ|GENERIC_WRITE, 	// Access mode
		0,				// Share Mode = not shared
		NULL,				// Security
		OPEN_EXISTING,			// Open existing
		FILE_FLAG_OVERLAPPED,		// File settings
		NULL);

	// Get the current COM1 settings
	GetCommState(h_COM, &amp;dcb);

	// Change the current COM1 settings
	dcb.BaudRate = CBR_115200;		// 115200 bits per second
	dcb.ByteSize = 8;			// 8 bit per byte
	dcb.Parity = 1;				// odd parity
	dcb.StopBits = 0;			// 1 stop bit

	// Set the new COM1 settings
	SetCommState(h_COM, &amp;dcb);

	// Set COM1 Event Mask
	SetCommMask(h_COM,			// Handle to COM
		EV_RXCHAR);			// Set Event if character receive

	// Create a new event
	h_Event = CreateEvent(NULL,		// Security Attributes
		FALSE,				// Auto Reset
		FALSE,				// Initial State
		NULL);				// Name

	// Assign event to overlapped structure
	o.hEvent = h_Event;

	// Wait for event to happen
	if(!WaitCommEvent(h_COM, &amp;dw_Ret,&amp;o))
        {
		LPTSTR pMessageBuffer;

		::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
				NULL,
				::GetLastError(),
				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
				reinterpret_cast&lt;LPTSTR&gt;(&amp;pMessageBuffer),
				0,
				NULL);

		std::string errorMessage(pMessageBuffer);

		cout &lt;&lt; errorMessage.c_str() &lt;&lt; endl;
        }	

	// Perform overloapped read operation 
	// ReadFile immediatly returns        
	ReadFile(h_COM,					// Handle to COM
		&amp;c_Buffer,				// Buffer to receive
		1,					// # Bytes to receive
		&amp;dw_Ret,				// Bytes transferred
		&amp;o);					// Overlapped structure

	// Wait for read operation to be finished	
	GetOverlappedResult(h_COM,			// Handle to COM
		&amp;o,					// Overlapped structure
		&amp;dw_Ret,				// Bytes transferred
		TRUE);					// WAIT flag

	// Close COM1
	CloseHandle(h_COM);				// Close COM Resource

	// Close event
	CloseHandle(h_Event);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/663292</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/663292</guid><dc:creator><![CDATA[nike.]]></dc:creator><pubDate>Wed, 01 Dec 2004 00:25:55 GMT</pubDate></item><item><title><![CDATA[Reply to WaitCommEvent Problem: GetLastError() sagt: Überlappender E&#x2F;A Vorgang wird bearbeitet on Wed, 01 Dec 2004 08:27:28 GMT]]></title><description><![CDATA[<p>Auf welchen Event soll die Funktion denn warten?</p>
<p>Das fehlt noch:</p>
<pre><code class="language-cpp">DWORD dwEvtMaskIn = EV_CTS | EV_DSR | EV_BREAK | EV_RING | EV_RXCHAR | 
                    EV_RLSD | EV_ERR | EV_RXFLAG | EV_TXEMPTY |
                    SERIAL_EV_PERR | SERIAL_EV_RX80FULL |
                    SERIAL_EV_EVENT1 | SERIAL_EV_EVENT2;
SetCommMask (h_COM, dwEvtMaskIn);
</code></pre>
<p>Nach dem WaitCommEvent() dann:</p>
<pre><code class="language-cpp">if (WAIT_OBJECT_0 == WaitForSingleObject (o.hEvent, INFINITE))
{
    if (dw_Ret &amp; EV_DSR) 
        // mach was ...
...
</code></pre>
<p>Blackbird</p>
]]></description><link>https://www.c-plusplus.net/forum/post/663356</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/663356</guid><dc:creator><![CDATA[Blackbird]]></dc:creator><pubDate>Wed, 01 Dec 2004 08:27:28 GMT</pubDate></item><item><title><![CDATA[Reply to WaitCommEvent Problem: GetLastError() sagt: Überlappender E&#x2F;A Vorgang wird bearbeitet on Wed, 01 Dec 2004 14:41:52 GMT]]></title><description><![CDATA[<p>hi!<br />
hab ich doch e definiert!!!</p>
<pre><code class="language-cpp">// Set COM1 Event Mask 
    SetCommMask(h_COM,            // Handle to COM 
                EV_RXCHAR);       // Set Event if character receive
</code></pre>
<p>hm??? ich mach doch eigentlich alles richtig!?</p>
<p>cu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/663642</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/663642</guid><dc:creator><![CDATA[nike.]]></dc:creator><pubDate>Wed, 01 Dec 2004 14:41:52 GMT</pubDate></item><item><title><![CDATA[Reply to WaitCommEvent Problem: GetLastError() sagt: Überlappender E&#x2F;A Vorgang wird bearbeitet on Wed, 01 Dec 2004 16:00:30 GMT]]></title><description><![CDATA[<p>im <a href="http://winapi.net" rel="nofollow">winapi.net</a> forum hast du doch schon die antwort bekommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/663714</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/663714</guid><dc:creator><![CDATA[tzzzzzzz]]></dc:creator><pubDate>Wed, 01 Dec 2004 16:00:30 GMT</pubDate></item><item><title><![CDATA[Reply to WaitCommEvent Problem: GetLastError() sagt: Überlappender E&#x2F;A Vorgang wird bearbeitet on Thu, 02 Dec 2004 08:31:06 GMT]]></title><description><![CDATA[<blockquote>
<p>hm??? ich mach doch eigentlich alles richtig!?</p>
</blockquote>
<p>Offenbar nicht, denn sonst würde es ja funktionieren <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>OK., das SetCommMask() fehlt nicht, aber worauf wartest Du denn mit WaitCommEvent()? Der Returnwert, sagt ja nur, daß eine Aktion ausgeführt wird, nicht dass Fehler vorliegen. Der Buffer dw_Ret (hast vergessen, ihn vor dem Aufruf zu &quot;nullen&quot;) enthält den Event, WENN er denn mal eintritt. Solange mußt Du warten (lassen) mit WaitForSingleObject().</p>
<p>Wo ist das Problem?</p>
<p>Blackbird</p>
]]></description><link>https://www.c-plusplus.net/forum/post/664192</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/664192</guid><dc:creator><![CDATA[Blackbird]]></dc:creator><pubDate>Thu, 02 Dec 2004 08:31:06 GMT</pubDate></item></channel></rss>