次の方法で共有


GetCommModemStatus (Compact 2013)

3/28/2014

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

See Also

Reference

Serial Communications Functions
WaitCommEvent

Other Resources

CreateFile