进入COM端口> 10 [英] Access COM Port >10
本文介绍了进入COM端口> 10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友,
我是C ++的新手.现在我在COM Port项目中工作.我有一个用于访问COM端口数据(发送和接收)的DLL文件.现在,我从COM1到COM9.但是我无法在COM10之上访问.为什么?如何解决此问题?请告诉我.
谢谢与问候
Naraayanan.
Hi Friends,
I am new for C++.Now i am working in a COM Port Project. I have a DLL File for accessing COM Port data(sending and Receiving).Now,I access COM1 to COM9.But i can''t access above COM10.Why?how can i solve this problem?please tell me.
Thanks and Regards
Naraayanan.
推荐答案
CreateFile()
可用于使用文件名从"COM1"到"COM9"访问串行端口;但是,如果使用"COM10"或更高版本,则会返回消息INVALID_HANDLE_VALUE
.
对于端口>如图9所示,在调用CreateFile()
时指定串行端口的正确方法如下:
CreateFile()
can be used to access serial ports using "COM1" through "COM9" for the name of the file; however, the messageINVALID_HANDLE_VALUE
is returned if you use "COM10" or greater.
For ports > 9, the correct way to specify the serial port in a call toCreateFile()
is as follows:
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
另外,请确保已实际安装要尝试访问的COM设备.您可以使用免费软件程序SIW进行验证: http://www.gtopala.com/ [
Also, be sure the COM device you are trying to access is actually installed. You can use the freeware program SIW to verify this: http://www.gtopala.com/[^]
这篇关于进入COM端口> 10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文