11-02-2010 10:17 AM
Hi,
I have a problem with InstallComCallback and special events generated by the port driver.
I'm controlling a FTDI-based device by using a virtual com port driver and the RS-232 library functions from CVI. I want to use a com-callback for a special event (EV_EVENT2) which is generated by the driver on surprise removal of the device. But InstallComCallback() doesn't accept it and returns 'invalid argument'.
So I tried to call GetSystemComHandle() and use the Windows API function WaitCommEvent(). But the documentation of WaitCommEvent() told me, that WaitCommEvent() does not return until the specified event occurs if the com port wasn't opened with FILE_FLAG_OVERLAPPED. But it seems to be opened without this flag by OpenComConfig(), so WaitCommEvent() doesn't return and my whole application stopped.
Are there any suggestions how I can handle this event without replacing all RS-232 library functions with the Windows API calls?
Best regards,
Martin Schmidt
11-03-2010
07:33 AM
- last edited on
05-17-2024
01:36 PM
by
Content Cleaner
Hi Martin
I found several informations about using the ComCallback:
Using the RS232 Library InstallComCallback Function to Handle Events
Otherway, to catch events that occur when you remove a serial device requires that you use Windows-based functionality to catch Windows events.
Hope that helps.
Kind regards
Pixar