I can open a serial port in this way.

hCommPort = CreateFile("COM2", GENERIC_READ | GENERIC_WRITE, 0,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);

if ( hCommPort == INVALID_HANDLE_VALUE )
{
AfxMessageBox("NOT VALID COM2");
return;
}




It detects if a port is in use. Unfortunately if my mouse is connected it hangs the mouse.

How can I check if a port is free without hanging my mouse. Win95/98.

Any ideas?

Thanks