I'm using Visual C++ 6.0 and the Win32 API (not MFC), and trying to detect if there is or is not a serial device connected to COM 1? How can this be achieved?
I have a Sony VTR connected to a PC via an RS232(PC COM1 port)/RS422(VTR RS422 In port) cable. Sending and receiving data is done through the "WriteFile", "WaitCommEvent" (with the EV_RXCHAR mask), and "ReadFile" API commands in that order. When the device is connected everything seems to work fine. But when the device is off, "WriteFile" still suceeds writing the required number of bytes (I don't know why this would suceed if the device was off!) and the program hangs on the "WaitCommEvent" as it it never satisfied because no bytes are received.
How do I get around this problem?
How can I tell if a device (not a modem) is connected/on without the program hanging?
I've done a lot of research and still can't find the answer!
Many thanks in advance.