WaitCommEvent
- From: "Dave Cullen" <none@xxxxxxxx>
- Date: Thu, 9 Apr 2009 11:45:15 -0400
I want to count pulses appearing on the CTS and DSR lines of a serial port.
The example "Monitoring Communications Events" in MSDN is perfect, except
that I can't get the code to work. I'd like to put this block into a
do-while loop, but it generates an error 87 (ERROR_INVALID_PARAMETER) on the
2nd pass through the loop.
if (WaitCommEvent(hCom, &dwEvtMask, &o))
{
if (dwEvtMask & EV_DSR)
{
// To do.... count DSR pulses
}
if (dwEvtMask & EV_CTS)
{
// To do.... count CTS pulses
}
}
else
{
DWORD dwRet = GetLastError();
if( ERROR_IO_PENDING == dwRet)
{
printf("I/O is pending...\n");
// To do... continue loop
}
else
printf("Wait failed with error %d.\n", GetLastError());
}
All parameters are the same as the MS example. Do I need to reset somthing
to be able to use WaitCommEvent in a loop?
Thanks
drc
.
- Follow-Ups:
- Re: WaitCommEvent
- From: Scott McPhillips [MVP]
- Re: WaitCommEvent
- From: Igor Tandetnik
- Re: WaitCommEvent
- Prev by Date: Re: Reentrancy
- Next by Date: Re: WaitCommEvent
- Previous by thread: Messages in and out on different threads - but send to client on just one main thread
- Next by thread: Re: WaitCommEvent
- Index(es):
Relevant Pages
|