Home > Software engineering >  SerialPort ClosePort ()
SerialPort ClosePort ()

Time:12-09

In LONG CSerialPortTestDlg: : OnCommunication (WPARAM ch, LPARAM port) function immediately after the conclusion of the accept close a serial port m_Com. ClosPort ();
Not completely closed, open for a second time to a serial port card dead, your bosses to solve!

CodePudding user response:

refer to the original poster south have arbor cc reply:
in LONG CSerialPortTestDlg: : OnCommunication (WPARAM ch, LPARAM port) function immediately after the conclusion of the accept close a serial port m_Com. ClosPort ();
Not completely closed, open for a second time to a serial port card dead, your bosses to solve!

Mean in OnCommunication close port?
This is typically a callback function, in close port, because the callback haven't finished that you can't accomplish certain closed release operation,
Closing suggested to deliver a message or start a timer, for close port operation


CodePudding user response:

//close Comm
PurgeComm (m_idComDev, PURGE_TXABORT | PURGE_RXABORT |
PURGE_TXCLEAR | PURGE_RXCLEAR);
//
The CloseHandle (m_idComDev);
  • Related