GetCommModemStatus

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function retrieves modem control-register values.

Syntax

BOOL GetCommModemStatus(
  HANDLE hFile,
  LPDWORD lpModemStat
);

Parameters

  • hFile
    [in] Handle to the communication device, returned by the CreateFile function.
  • lpModemStat
    [out] Long pointer to a 32-bit variable that specifies the current state of the modem control-register values. The following table shows possible values.

    Value Description

    MS_CTS_ON

    The clear-to-send (CTS) signal is on.

    MS_DSR_ON

    The data-set-ready (DSR) signal is on.

    MS_RING_ON

    The ring indicator signal is on.

    MS_RLSD_ON

    The receive-line-signal-detect (RLSD) signal is on.

Return Value

Nonzero indicates success. Zero indicates failure. To obtain extended error data, call the GetLastError function.

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.

Requirements

Header winbase.h
Library Serdev.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

Serial Communications Functions
WaitCommEvent

Other Resources

CreateFile