SetHandFlow Method

The SetHandFlow method sets the configuration of handshake flow control.

BOOL SetHandFlow(
  	ULONG ControlHandShake, 	// Handshake control parameter
  	ULONG FlowReplace, 	// Flow control parameter
  	ULONG XOnLimit, 	// Flow control parameter
  	ULONG XOffLimit 	// Flow control parameter
);

Parameters:

  • ControlHandShake [out] : ControlHandShake is a set of flags that defines the modem lines that are used for flow control. Can be combination of the following flags:
    ValueMeaningHex
    SERIAL_DTR_CONTROLEnables the DTR line when the device is opened and leaves it on.0x01
    SERIAL_DTR_HANDSHAKEUse the modem signal DTR for input flow control. For the real serial port the DTR line is cleared by
    the controller if the receive buffer reaches the programmed high water mark.
    See also description of XonLimit and XoffLimit.
    0x02
    SERIAL_CTS_HANDSHAKEUse the modem signal CTS, DCD or DSR respectively for output flow control.
    For the real serial port if the corresponding modem line(s) found as cleared, the controller will hold
    data transmission.
    0x08
    SERIAL_DCD_HANDSHAKE0x20
    SERIAL_DSR_HANDSHAKE0x10
    SERIAL_DSR_SENSITIVITYIgnore any character arriving when the DSR line is not set.0x40
    SERIAL_ERROR_ABORTIf there exists an error condition the driver abort all read and writes to or from
    this port.
    0x80000000
  • FlowReplace [out] : FlowReplace is a set of flags defining flow control stuff. Can be combination of the following flags:
    ValueMeaningHex
    SERIAL_AUTO_TRANSMITUse the XON/XOFF protocol based flow control for output.
    0x01
    SERIAL_AUTO_RECEIVEUse the XON/XOFF protocol based flow control for input.
    0x02
    SERIAL_ERROR_CHARIf set, the ErrorChar is placed in the stream of received characters on error
    conditions like buffer overflow, frame errors and so on.
    0x04
    SERIAL_NULL_STRIPPINGIf set, the reception of a NULL character is ignored.
    0x08
    SERIAL_BREAK_CHARIf set, the BreakChar is placed in the stream of received characters when a
    break condition was detected.
    0x10
    SERIAL_RTS_CONTROLEnables the RTS line when the device is opened and leaves it on.
    0x40
    SERIAL_RTS_HANDSHAKEUse the modem signal RTS for input flow control.
    0x80
  • XOnLimit [out] : Minimum number of bytes allowed in the input buffer before flow control is activated to inhibit the sender.
  • XOffLimit [out] : Maximum number of bytes allowed in the input buffer before flow control is activated to allow transmission by the sender.

Return Values : If the function succeeds, the return value is TRUE, otherwise the return value is FALSE.

Notes:

  1. This method is available starting from Windows 2000 only.
  2. these port settings are actual untill they are not changed by VSP AX or application, which opened virtual serial port. If these settings are changed, you get a corresponding message (in that case OnHandFlow event). Be carefull, when you are changing this parameter from VSP AX in event body, as you might get into an endless loop.