SerialPort与CreateFile [英] SerialPort vs CreateFile
本文介绍了SerialPort与CreateFile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以在c#
中使用SerialPort类访问任何COM端口,我也可以使用CreateFile API获取Com的句柄并用于与
这是这两种方法的区别吗?
好像我无法连接到Com使用SerialPort我可以使用CreateFile API吗?
I can access any COM Port using SerialPort class in c#
and also i can use the CreateFile API to get handle for Com and use to communicate with
is this a difference between these two method?
as if i can't do connection to Com using SerialPort can i do this using CreateFile API?
推荐答案
CreateFile
到COM端口,有时> i>需要管理员访问权限(并非总是如此)。
SerialPort
是首选方式,因为它允许您同时控制其他各种利基选项,这不是CreateFile
请参阅MSDN [ ^ ]了解详情。
CreateFile
to COM port, sometimes requires admin access (not always).
SerialPort
is the preferred way since it allows you to cotrol various other niche options too, that isn't easily available inCreateFile
See MSDN[^] for details.
这篇关于SerialPort与CreateFile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文