Solved

Check DCD(Data Carrier Detect) using MFC

Posted on 1997-09-19
1
441 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

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…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

696 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