int GetCommState(idComDev, lpdcb) | |||||
int idComDev; | /* communications device identifier | */ | |||
DCB FAR* lpdcb; | /* address of structure for device control block | */ |
The GetCommState function retrieves the device control block for the specified device.
idComDev
Specifies the device to be examined. The OpenComm function returns this value.
lpdcb
Points to the DCB structure that is to receive the current device control block. The DCB structure defines the control settings for the device. It has the following form:
typedef struct tagDCB /* dcb */
{
BYTE Id; /* internal device identifier */
UINT BaudRate; /* baud rate */
BYTE ByteSize; /* number of bits/byte, 4-8 */
BYTE Parity; /* 0-4=none,odd,even,mark,space */
BYTE StopBits; /* 0,1,2 = 1, 1.5, 2 */
UINT RlsTimeout; /* timeout for RLSD to be set */
UINT CtsTimeout; /* timeout for CTS to be set */
UINT DsrTimeout; /* timeout for DSR to be set */
UINT fBinary :1; /* binary mode (skip EOF check) */
UINT fRtsDisable :1; /* don't assert RTS at init time */
UINT fParity :1; /* enable parity checking */
UINT fOutxCtsFlow :1; /* CTS handshaking on output */
UINT fOutxDsrFlow :1; /* DSR handshaking on output */
UINT fDummy :2; /* reserved */
UINT fDtrDisable :1; /* don't assert DTR at init time */
UINT fOutX :1; /* enable output XON/XOFF */
UINT fInX :1; /* enable input XON/XOFF */
UINT fPeChar :1; /* enable parity err replacement */
UINT fNull :1; /* enable null stripping */
UINT fChEvt :1; /* enable Rx character event */
UINT fDtrflow :1; /* DTR handshake on input */
UINT fRtsflow :1; /* RTS handshake on input */
UINT fDummy2 :1;
char XonChar; /* Tx and Rx XON character */
char XoffChar; /* Tx and Rx XOFF character */
UINT XonLim; /* transmit XON threshold */
UINT XoffLim; /* transmit XOFF threshold */
char PeChar; /* parity error replacement char */
char EofChar; /* end of Input character */
char EvtChar; /* received event character */
UINT TxDelay; /* amount of time between chars */
} DCB;
For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.
The return value is zero if the function is successful. Otherwise, it is less than zero.