我看了MSDN.处理是:case ERROR_IO_PENDING:
{
// asynchronous i/o is still in progress
// do something else for a while
GoDoSomethingElse() ;
// check on the results of the asynchronous read
bResult = GetOverlappedResult(hFile, &gOverlapped,
&nBytesRead, FALSE) ;
// if there was a problem ...
if (!bResult)
{
// deal with the error code
switch (dwError = GetLastError())
{
case ERROR_HANDLE_EOF:
{
// we're reached the end of the file
//during asynchronous operation
}
// deal with other error cases
}
}
} // end case 好像是等待的时间很短就去读串口了,但我已经等待了2妙还是不行.要怎么样处理这个问题呢?
{
// asynchronous i/o is still in progress
// do something else for a while
GoDoSomethingElse() ;
// check on the results of the asynchronous read
bResult = GetOverlappedResult(hFile, &gOverlapped,
&nBytesRead, FALSE) ;
// if there was a problem ...
if (!bResult)
{
// deal with the error code
switch (dwError = GetLastError())
{
case ERROR_HANDLE_EOF:
{
// we're reached the end of the file
//during asynchronous operation
}
// deal with other error cases
}
}
} // end case 好像是等待的时间很短就去读串口了,但我已经等待了2妙还是不行.要怎么样处理这个问题呢?
解决方案 »
- 面试归来:纸上写程序,写得我快要吐了!
- C++ Builder 编的DLL, VC调用不成功
- 关于 CAsyncSocket Send 的一个小问题!!!!!!!! 马上给分
- 请教:在VC里如何实现地形图三维显示??
- 如何进行文件格式分析?高分相送
- 将CToolBar m_toolbar 和CStatusBar m_statusbar动态的设置showwindow的问题
- 『菜鸟继续送分』如何 动态 的改变button上面的字体颜色??
- 一个药店的管理软件的问题?
- 弱问题:线程中用阻塞函数合不合理,会影响主线程的运行吗?
- VS2008 Debug窗口没有memory怎么办?重装几次了!
- vss联不上的问题。
- 高分给,有什么好的软件可以看到程序是在哪又申请内存了使内存增加了的呀?
{
while( !GetOverlappedResult(m_hCom,&m_ros,&dwRead,FALSE ) )
{
dwErrCode = GetLastError();
if( dwErrCode == ERROR_IO_INCOMPLETE )
{
if ((GetTickCount()-dwTime) > nTimeOut)
{
ClearCommError( m_hCom, &dwErrorFlags, &ComStat );
return QE_FAIL;
}
Sleep(1000) ;
continue;
}
else
{
ClearCommError( m_hCom, &dwErrorFlags, &ComStat ) ;
if ( dwErrorFlags > 0)
{
//g_pEventLog->ErrorEventParamLog("Read COM Error: %u,<CE-%u>",dwErrCode,dwErrorFlags ) ;
}
break ;
}
}
}而用GetOverlappedResult返回的结果是true.那会是哪里的问题呢?