DELPHI中,打开串口函数CREATEFILE调用的是SYSTEM32目录下KERNEL32.DLL中的函数,
我试着在设备管理器中把COM1依次改为COM2,COM3……直到COM10(因为需要很多接口),发现,从1到9都可以打开,改为COM10后,就打开不了了。这个怎么解决啊?

解决方案 »

  1.   

    CreateFile(
          "\\\\.\\COM10",     // address of name of the communications device
          fdwAccess,          // access (read-write) mode
          0,                  // share mode
          NULL,               // address of security descriptor
          OPEN_EXISTING,      // how to create
          0,                  // file attributes
          NULL                // handle of file with attributes to copy
       );
      

  2.   

    CreateFile(PChar('\\.\' +FCommName)....用这个,前面加个 \\.\