连续读取USB端口. [英] Read USB Port Continuously.

查看:100
本文介绍了连续读取USB端口.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我按一个按钮并在MFC中打开一个对话框时就连续不断地从USB端口读取数据吗?请有人帮我吗?
在此先感谢.

i want to read the data from USB Port continuously as soon as i press a button and Open a dialog box in MFC? Pls someone help me out?
Thanks in Advance.

推荐答案

不,你不知道.

您真正想要做的是处理SerialPort DataRecieved消息,并在到达每个字节时对其进行处理,或者将它们传输到缓冲区以在后台进行处理.

如果您尝试连续阅读,则会锁定UI并惹恼您的用户...
No, you don''t.

What you actually want to do is handle the SerialPort DataRecieved messages, and process each byte as it arrives, or transfer them to a buffer for processing in the background.

If you try to read continuously, you will lock up your UI and annoy your users...


CP上有一些类似的应用程序-搜索并浏览它们.这是一个入门的指南: CSerialIO-有用且简单的串行通信类 [ ^ ]

您标记了C ++,所以这是我在此处添加的示例.如果您感兴趣,C#中还有其他不错的项目.

Soren Madsen
There are several applications like that here on CP - search and look through them. Here is one to get you started: CSerialIO - A Useful and Simple Serial Communication Class[^]

You tagged C++, so that is the example I added here. There are other nice projects in C# if you are interested.

Soren Madsen


这篇关于连续读取USB端口.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆