用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