Solved

RS232 Communication in an MFC App

Posted on 1997-11-30
1
450 Views
Last Modified: 2012-06-21
I wish to write an MFC program that sends/receives data from COM2.  I know i can't use the inp and outp calls found in dos programs.  Are there any API functions that I can use? Can I use CFile to open and read/write to a serial port?
I would appreciate code snippets.  Many thanks!!!
0
Comment
Question by:karlon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
chensu earned 40 total points
ID: 1174451
Use Win32 Communication Functions.

The following functions are used with communications devices.
 
BuildCommDCB  
BuildCommDCBAndTimeouts  
ClearCommBreak  
ClearCommError  
CommConfigDialog  
DeviceIoControl  
EscapeCommFunction  
GetCommConfig  
GetCommMask  
GetCommModemStatus  
GetCommProperties  
GetCommState  
GetCommTimeouts  
GetDefaultCommConfig  
PurgeComm  
SetCommBreak  
SetCommConfig  
SetCommMask  
SetCommState  
SetCommTimeouts  
SetDefaultCommConfig  
SetupComm  
TransmitCommChar  
WaitCommEvent  

There is a sample "Comm: Communications Demonstration" that comes with Win32 SDK or Visual C++.

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question