
43 PCI-1680U/1682U User Manual
Chapter 4 Software Requirements
Return Value
Successful: return non-zero values. Unsuccessful: return zero value. Please call Get-
LastError function.
If users cancel the operation or reset chip, GetLastError will be called to return
ERROR_OPERATION_ABORTED.
In asynchronous mode, operation will be pending if drivers cannot complete user's
request, and GetLastError will be called to return ERROR_IO_PENDING.
See MSDN for more information.
Example
Wait event in synchronous mode.
BOOL bSuccess = SetCommMask(hDevice, EV_ERR | EV_RXCHAR);
if(!bSuccess)
{
//error
}
DWORD dwMask = 0;
bSuccess = WaitCommEvent(hDevice, &dwMask, NULL);
if(bSuccess)
{
if(dwMask & EV_ERR)
{
//to do
DWORD dwError;
ClearCommError(hDevice, &dwError, NULL);
}
if(dwMask & EV_RXCHAR)
{
//to do
}
}
See Also
SetCommMask
ClearCommError
Comentarios a estos manuales