Home > Software engineering >  Consult a great god is occupied (how to determine a serial port)
Consult a great god is occupied (how to determine a serial port)

Time:10-01

With VS2013 VB to write a small program, serial port consult the great god, how to determine a serial port is occupied,

CodePudding user response:

Try to open the serial port, if the error can be occupied

CodePudding user response:

To open the serial port, if an error is occupied

CodePudding user response:

refer to the original poster a1287993605 response:
with VS2013 VB to write a small program, a serial port to ask the great spirit, how to determine a serial occupied,


Open the serial port, to check the exception error

CodePudding user response:

Agreed to the third floor, a serial port mapping files, so use the CreateFile function, also open on failure returns INVALID_HANDLE_VALUE, again through the GetLastError function for error detailed information, if because of a serial port before that has been opened by other program this function will return 5 (ERROR_ACCESS_DENIED),
  • Related