[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

RS232 Communication in an MFC App

Posted on 1997-11-30
1
Medium Priority
?
486 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 80 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
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 viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

872 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