Article 4458 of microsoft.public.win32.programmer.kernel:
I don't have the comm example from 5.0, but I think this is not the most
efficient way for RS232 communications.

>    // disable event notification and wait for thread
>    // to halt
> 
>    SetCommMask( COMDEV( npTTYInfo ), 0 ) ;

I use an event to end a thread:

SetEvent ( EndThreadEvent );

Use the HANDLE EndThreadEvent in your WaitForMultipleObject() call.
 
>    OVERLAPPED  os ;

Where is OVERLAPPED os used in this function? Is the COMM port opened
for OVERLAPPED I/O ?

> 
>       WaitCommEvent( COMDEV( npTTYInfo ), &dwEvtMask, NULL );
> 
>       if ((dwEvtMask & EV_RXCHAR) == EV_RXCHAR)

You wait till one or more characters are received, as long as there are no
characters received, WaitCommEvent() will wait. If WaitCommEvent() is 
waiting, and you use SetCommMask( xxx, 0 ), I'm not sure the 
WaitCommEvent() will return so the thread can end.

>    CloseHandle( os.hEvent ) ;

As far as I can see os is never use (just for CreateEvent).


The COMM example of MSVC 1.52 and 4.2 are very unclear, in my opinion. 
Open the port with overlapped I/O, use WaitCommEvent() with the overlapped
structure and use a Wait...() function to wait for an event. Create an
event
wich you can signal to end your thread. 

Rene Balvert



