BOOL WINAPI ClearCommError(
_In_ HANDLE hFile,
_Out_opt_ LPDWORD lpErrors,
_Out_opt_ LPCOMSTAT lpStat
);
lpStat [out, optional]
A pointer to a COMSTAT structure in which the device's status information is returned. If this parameter is NULL, no status information is returned.
typedef struct _COMSTAT {
DWORD fCtsHold :1;
DWORD fDsrHold :1;
DWORD fRlsdHold :1;
DWORD fXoffHold :1;
DWORD fXoffSent :1;
DWORD fEof :1;
DWORD fTxim :1;
DWORD fReserved :25;
DWORD cbInQue;
DWORD cbOutQue;//The number of bytes of user data remaining to be transmitted for all write operations. This value will be zero for a nonoverlapped write.
} COMSTAT, *LPCOMSTAT;