?
Solved

Check DCD(Data Carrier Detect) using MFC

Posted on 1997-09-19
1
Medium Priority
?
451 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 100 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

840 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