MFC 串行通信
我需要向我的 MFC 应用程序添加串行端口(例如 COM8)通信。我应该使用哪些 API 来执行此操作?我需要它能够在触发(事件、消息、回调等)之前等待 n 个字节进入接收队列。有没有一个相对简单的方法来做到这一点?我看过的所有示例似乎都使用轮询机制进行接收。这对我的应用程序不起作用。需要有某种触发机制,当队列中有n个字节时触发。谢谢。
I need to add serial port (e.g. COM8) communications to my MFC application. Which APIs should I be looking at to do this? I need it to be able to wait for n bytes to be in the receive queue before triggering (event, message, callback, etc.). Is there a relatively simple way to do this? All the examples I have looked at appear to use a polling mechanism for receive. This will not work for my application. There needs to be some sort of triggering mechanism that is triggered when there are n bytes in the queue. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Win32 中的重叠 I/O 效果非常好:
http://www.codeproject.com/KB/system/serial_com.aspx
另外,据我所知,没有用于串行通信的官方 MFC 类。 (不过这些可以很容易地包裹起来)。
Overlapped I/O in Win32 works really well:
http://www.codeproject.com/KB/system/serial_com.aspx
Also AFAIK, there are no official MFC class(es) for serial communications. (These could be easily wrapped though).