请教如何操作 Com10 以上的串口?

Fu7iang 2005-11-19 07:54:19

如何操作 Com10 以上的串口?
Com10 在 CreateFile 中全名怎么写?

谢谢
...全文
168 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
兔子-顾问 2005-11-20
  • 打赏
  • 举报
回复
You can use paths longer than MAX_PATH characters by calling the wide (W) version of CreateFile and prepending "\\?\" to the path. The "\\?\" tells the function to turn off path parsing. This lets you use paths that are nearly 32,000 Unicode characters long. However, each component in the path cannot be more than MAX_PATH characters long. You must use fully-qualified paths with this technique. This also works with UNC names. The "\\?\" is ignored as part of the path. For example, "\\?\C:\myworld\private" is seen as "C:\myworld\private", and "\\?\UNC\tom_1\hotstuff\coolapps" is seen as "\\tom_1\hotstuff\coolapps".
bubugao 2005-11-20
  • 打赏
  • 举报
回复
用这个绝对可以 "\\\\.\\"+"Com"+comNo
不用的话只可以打开8个com 端口!
Fu7iang 2005-11-20
  • 打赏
  • 举报
回复

我也是初次接触 COM 开发,请问有现成的 Com 操作类吗?

sdenli 2005-11-19
  • 打赏
  • 举报
回复
楼主你为什么不用C#写的现成的COM口类呢?象这种问题就根本不需要去多考虑了

==============================================
需要在上海租房的朋友联系我。在松江九亭有房出租

tiaoci 2005-11-19
  • 打赏
  • 举报
回复
从来没看到过有这么多COM口的机器,不过我觉得应当是这么写

CreateFile(@"\\.\COM10"....

或者

CreateFile(@"\\?\COM10"....

你两个都试试吧,应当有一个可行
moodboy1982 2005-11-19
  • 打赏
  • 举报
回复
直接写?好郁闷呀。
听说C#不是C语言,可以操作硬件吧。
moodboy1982 2005-11-19
  • 打赏
  • 举报
回复
用C#操作Com10以上的串口?
不知楼主是否已经知道了操作Com10以下的串口了呢?
兔子-顾问 2005-11-19
  • 打赏
  • 举报
回复
不明白,直接写COM11 ....
不可以么?我这里只有一个串口。无法测试。楼主?
Fu7iang 2005-11-19
  • 打赏
  • 举报
回复

在 C# 中可以调用 CreateFile 函数打开串口吧
Fu7iang 2005-11-19
  • 打赏
  • 举报
回复

据说 Com9 以下的串口直接在 CreateFile 中的参数写 Com1 - 9 就可以
而 Com9 以上要写 Com 的全称,就是带斜杠的那种: /???/??/ComX

哪位老兄做过这方面的项目,给点提示呗,谢谢!

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧