// get a handle to the port
m_hComm = CreateFile(_T("\\.\COM11"), // communication port string (COMX)
GENERIC_READ | GENERIC_WRITE, // read/write types
0, // comm devices must be opened with exclusive access
NULL, // no security attributes
OPEN_EXISTING, // comm devices must use OPEN_EXISTING
FILE_FLAG_OVERLAPPED, // Async I/O
0); // template must be 0 for comm devices
if (m_hComm == INVALID_HANDLE_VALUE)
{
// port not found
delete [] szPort;
delete [] szBaud;
return FALSE;
}
com10以上,CreateFile的第一个参数要变成\\.\ + COM11
CreateFile打开串口失败(com10以上)

相关文章:

  • 2022-03-04
  • 2021-07-15
  • 2021-11-10
  • 2021-09-12
  • 2021-09-06
  • 2021-08-25
  • 2021-04-16
  • 2022-02-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2022-12-23
  • 2021-04-24
  • 2021-09-20
  • 2022-12-23
相关资源
相似解决方案