用CreateFile打开串口超过com10就不能打开,解决办法

Posted micq

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用CreateFile打开串口超过com10就不能打开,解决办法相关的知识,希望对你有一定的参考价值。

10以下的串口可以这样打开

CreateFile( 
              "COM5",          //  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 
        ); 

10以上的串口要这样才打的开

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 
        ); 

 

以上是关于用CreateFile打开串口超过com10就不能打开,解决办法的主要内容,如果未能解决你的问题,请参考以下文章