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.
本文深入探讨BOOLWINAPI的ClearCommError函数,包括其参数解释、返回值和重要备注。此函数用于清除通讯设备错误状态,并提供设备状态信息。了解如何正确使用此函数对于维护稳定可靠的通讯系统至关重要。

4116

被折叠的 条评论
为什么被折叠?



