INtime SDK Help
SetCommState (Serial Communications)
INtime SDK v7.1 > About INtime > Networking and I/O > Serial Communications (COMM) > SetCommState (Serial Communications)

Configures a communications device according to the specifications in a device-control block (a DCB structure). The function reinitializes all hardware and control settings, but it does not empty output or input queues.

BOOLEAN SetCommState(
  COMMHANDLE hComm,  // handle to communications device
  LPDCB lpDCB        // device-control block


[in] Handle to the communications device. The OpenComm function returns this handle.
[in] Pointer to a DCB structure that contains the configuration information for the specified communications device.

Return Values

0 (zero)
Failure. To determine the status, call GetLastRtError.


An I/O operation is already in progress.
COMM channel is closed.
Invalid parameter.


This function uses a DCB structure to specify the desired configuration. GetCommState returns the current configuration.

To set only a few members of the DCB structure, you should modify a DCB structure that has been filled in by a call to GetCommState. This ensures that the other members of the DCB structure have appropriate values.

SetCommState fails if the XonChar member of the DCB structure is equal to the XoffChar member.

When SetCommState is used to configure the 8250, the following restrictions apply to the values for the DCB structure's ByteSize and StopBits members:

The number of data bits must be 5 to 8 bits.


Versions Defined in Include Link to
INtime 3.1 intime/rt/include/comm.h comm.h comm.lib
See Also