GetCommModemStatus

This function retrieves modem control-register values.

At a Glance

Header file: Winbase.h
Windows CE versions: 1.0 and later

Syntax

BOOL GetCommModemStatus(HANDLE hFile, LPDWORD lpModemStat);

Parameters

hFile

[in] Handle to the communication device. The CreateFile function returns this handle.

lpModemStat

[out] Long pointer to a 32-bit variable that specifies the current state of the modem control-register values. This parameter can be a combination of the following values:

Value Description
MS_CTS_ON The CTS (Clear To Send) signal is on.
MS_DSR_ON The DSR (Data Set Ready) signal is on.
MS_RING_ON The ring indicator signal is on.
MS_RLSD_ON The RLSD (Receive Line Signal Detect) signal is on.

Return Values

Nonzero indicates success. Zero indicates failure. To get extended error data, call GetLastError.

Remarks

The GetCommModemStatus function is useful when using the WaitCommEvent function to monitor the CTS, DSR, 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.

See Also

CreateFile, WaitCommEvent