MFC 串行通信

发布于 2024-09-30 20:27:09 字数 176 浏览 0 评论 0原文

我需要向我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏日落 2024-10-07 20:27:09

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文