Solved

Check DCD(Data Carrier Detect) using MFC

Posted on 1997-09-19
1
433 Views
Last Modified: 2013-11-19
I want to check the DCD in a program which used for RS232
communication and written by MFC.
I can set DTR and RTS control via the data the structure
DCB. But there is no DCD checking parameter in DCB
structure. Can anyone tell me how to check DCD status?
0
Comment
Question by:hbh
[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 3

Accepted Solution

by:
stefanr earned 50 total points
ID: 1306594
You could user the WIN32 API function GetCommModemStatus, like this:

BOOL CComPort::GetCD() const
{
   DWORD dwModemStat = 0;

   if (!::GetCommModemStatus(m_hFile, &dwModemStat))
      TRACE("Warning: Failed to retrieve Modem Status. Error Code %lu\n", ::GetLastError());

   return (dwModemStat & MS_RLSD_ON) == MS_RLSD_ON;
}

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

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

726 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