C ++串行通讯 [英] C++ Serial Communcation

查看:79
本文介绍了C ++串行通讯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在查找和知道如何使用一些代码以便可以使用com端口的过程中,我遇到了很多麻烦.

我什至从该站点下载了代码,但我不知道如何使用它.似乎其中没有int main().

我已经买了一本书,但是必须与Visual Studio 2008或2010一起使用才是旧的.

如果有人能让我步入正轨,我将非常感激.

[更新]
昨晚我发现我的真正问题是我不知道如何正确使用Visual Studio 2008 C ++.您看,我学习了两本书,并且仅在控制台上工作(使用namespace.std).所以现在这些项目都使用了,我想您可以将它们称为GUI界面.
它完全使我感到震惊.我来自一个为编写通过RS232/422进行通信的微处理器的程序的背景.因此,我选择了C ++作为编写一些基于计算机的程序的语言,因为代码可以很容易地传输.
我以为我或多或少知道如何为C#GUI应用程序处理Visual Studio 2008.而且我认为对于C ++来说,它将是完全相同的.
SI昨晚发现了另一个由Shibu K.V编写的程序(shibukv@erdcitvm.org),该程序是从该网站下载的.
我不知道在哪里写我的代码.我在任何地方都看不到int main(),因此看不到起点.它可以编译,但是我不知道该在哪里写东西.
今晚我有更多时间时,我将看您建议的程序.但是我真正的问题是弄清楚如何与基于织补窗口的GUI进行接口.
[/Update]

I am having a heck of a lot of trouble finding and knowing how to use some code so that I can use a com port.

I have even downloaded code form this site and I can not figure out how to use it. There seems to be no int main () to any of it.

I''ve bought a book, but it must be to old to use with either visual studio 2008 or 2010.

If anybody can put me on track, I would very much appreciate it.

[Update]
I found out last night that my real problem is I do not know how to use Visual Studio 2008 C++ properly. You see, I studied two books and worked only from the console (Using namespace.std). So now these projects all use, I guess you could call them, GUI interfaces.
It has completely flabbergasted me. I come froma background where I wrote programs for microprocessors which communicate via RS232/422. So I picked C++ as the language to write some computer based programs since the code would transfer so easy.
I thought I knew more or less how to handle Visual Studio 2008 for C# GUI applications. And I figured it would be much the same for C++.
SI last night, I found another program written by Written by Shibu K.V (shibukv@erdcitvm.org) which I downloaded form this website.
I do not know where to write my code. I see no int main () in it anywhere, so I do not see a starting point. It compiles OK, but I do not know where I can write my stuff in there.
I''ll look at the program you suggested when I get a little more time tonight. But my real problem is figuring out how to interface with the darn windows based GUI.
[/Update]

推荐答案

Windows应用程序没有main函数(具有WinMain [使用通讯资源" [
Windows applications haven''t the main function (the have the WinMain[^] entry point, moreover if you are using a framework like MFC, such function is hidden).

You should read a good tutorial on Windows programming (or play a bit with Visual Studio generated skeleton for a Win32 or MFC application).

Usually you may directly use Win32 API (i.e. you don''t need third party libraries) for serial communication, their usage is pretty straightforward, see for instance "Using Communication Resources"[^] at MSDN.


这篇关于C ++串行通讯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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