GetCommModemStatus function (winbase.h)

Retrieves the modem control-register values.

Syntax

BOOL GetCommModemStatus(
  [in]  HANDLE  hFile,
  [out] LPDWORD lpModemStat
);

Parameters

[in] hFile

A handle to the communications device. The CreateFile function returns this handle.

[out] lpModemStat

A pointer to a variable that receives the current state of the modem control-register values. This parameter can be one or more of the following values.

Value Meaning
MS_CTS_ON
0x0010
The CTS (clear-to-send) signal is on.
MS_DSR_ON
0x0020
The DSR (data-set-ready) signal is on.
MS_RING_ON
0x0040
The ring indicator signal is on.
MS_RLSD_ON
0x0080
The RLSD (receive-line-signal-detect) signal is on.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The GetCommModemStatus function is useful when you are using the WaitCommEvent function to monitor the CTS, RLSD, DSR, or ring indicator signals. To detect when these signals change state, use WaitCommEvent and then use GetCommModemStatus to determine the state after a change occurs.

The function fails if the hardware does not support the control-register values.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header winbase.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

Communications Functions

Communications Resources

CreateFile

WaitCommEvent