評價: 0 回應: 0 閱覽: 148
置頂

BCB在開啟COM時產生問題

    問題是這樣的,在開啟COM時,COM1~9都沒有問題。

    但在COM10或更大的數字以上時卻會產生錯誤。

    上網google了很久,大部分都找到說是CreateFile將裡面的COMx改成////.//COMx

    但是我手上的程式完全沒有用到這一段,看到比較相關的似乎是用TComPortNumber


    Comm1->CommPort=TComPortNumber(ComPort->ItemIndex);

    我在這邊試著做一些改變,但徒勞無功。


    雖然有註解,但我還是不太了解網路上找到的這段。

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

    關於開啟COM10~不知道有沒有哪位大大願意解釋一下,謝謝。

 

會員登入 (先登入會員才能回覆留言喔!)

Facebook留言