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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM