Solved

Check DCD(Data Carrier Detect) using MFC

Posted on 1997-09-19
1
397 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
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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 tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 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

16 Experts available now in Live!

Get 1:1 Help Now