BOOL WINAPI ClearCommError( __in HANDLE hFile, __out_opt LPDWORD lpErrors, __out_opt LPCOMSTAT lpStat );
Parameters
-
hFile [in]
-
A handle to the communications device. The CreateFile function returns this handle.
lpErrors [out, optional]
-
A pointer to a variable that receives a mask indicating the type of error. This parameter can be one or more of the following values.
The following values are not supported:
- CE_DNS
- CE_IOE
- CE_MODE
- CE_OOP
- CE_PTO
- CE_TXFULL
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.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
If a communications port has been set up with a TRUE value for the fAbortOnError member of the setup DCB structure, the communications software will terminate all read and write operations on the communications port when a communications error occurs. No new read or write operations will be accepted until the application acknowledges the communications error by calling the ClearCommError function.
The ClearCommError function fills the status buffer pointed to by the lpStat parameter with the current status of the communications device specified by the hFile parameter.