Solved

RS232 Communication in an MFC App

Posted on 1997-11-30
1
454 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

695 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