Solved

RS232 Communication in an MFC App

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now