使用Windows窗体的VC ++中的串行通信(入门) [英] Serial communication in VC++ using windows form (Beginners)

查看:105
本文介绍了使用Windows窗体的VC ++中的串行通信(入门)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从命令行中接收数据并使用Windows窗体在Richtextbox中显示它.我只知道基本的c ++.我创建了一个带有两个按钮(读取和退出)和富文本框的Windows窗体.当我点击阅读按钮. richtextbox显示来自串行端口的值

有人可以帮我做还是建议一些教程.

附言我搜索后创建了这个主题.我希望有人可以为我提出一些建议.

Trying to receive a data from a comport and display it in richtextbox using windows form. I know only the basic c++ . I have created a windows form with two button(read and exit) and rich text box . When i click on read button . richtextbox display values from serial port

Can someone help me do it or suggest some tutorials .

P.S I have created this topic after searching . I hope someone can suggest something for me

推荐答案

您实际上并没有说出是哪一个引起您最大的问题,而是^ ]是有关串行端口处理的有用页面.
You don''t actually say which bit is causing you the biggest problem, but this[^] is a useful page on serial port handling.


您接受来自串行端口的RTF格式的字符串吗? :-)
我怀疑.为什么不使用TexBox?或者更好的是使用ListBox(方便一次附加一条消息).

不要尝试混用串行端口通信和System.Windows.Forms.单独的关注点.找出如何使用串行端口,找出如何进行UI(分别进行操作).甚至不要玩弄不使用线程的想法-创建一个单独的通信线程.

有关串行端口的编码示例,库和说明,请查看以下CodeProject文章:
在Win32上创建串行通讯 [ CSerialIO-一个有用且简单的串行通信类 [具有读取线程的串行端口R/W [ Windows中的串行通信 [简单串行通信 [ CSerialPort v1.03-串行端口包装器 [ CSerialCom-在Win-9X/2000中实现串行通信的简单类 [ C ++的串行库 [
Do you accept Rich text format string coming out from a serial port? :-)
I doubt. Why not using a TexBox? Or, better yet, a ListBox (convenient to append one message at a time).

Don''t try to mix serial port communication and System.Windows.Forms. Separate concerns. Find out how to work with the serial ports, find out how to do UI — separately. Don''t even play with the idea of not using threading — create a separate thread for communications.

For serial ports coding samples, libraries and directions, look at these CodeProject articles:
Creating a Serial communication on Win32[^],
CSerialIO - A Useful and Simple Serial Communication Class[^],
Serial Port R/W With Read Thread[^] (look how to use a separate thread and why),
Serial Communication in Windows[^],
Simple Serial Communication[^],
CSerialPort v1.03 - Serial Port Wrapper[^],
CSerialCom - A Simple Class for Implementing Serial Communication in Win-9X/2000[^],
Serial library for C++[^].

Google or search CodeProject to find more.

Good luck,
—SA


这是设计

http://s282. photobucket.com/albums/kk269/dxm4i/?action=view¤t=untitled.jpg [
This is the design

http://s282.photobucket.com/albums/kk269/dxm4i/?action=view¤t=untitled.jpg[^]

I should be able to select the port in combo box and when i click on read data button . Data should be displayed on textbox .

I know only the very basic of windows form like adding stuffs like that . Can somebody help me or give me tutorial from which i can get familiar with tools .

Thanks in advance . Code for the above program will be appreciated . Usually i click on the button and write codes for this i dont know how to write


这篇关于使用Windows窗体的VC ++中的串行通信(入门)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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