vc 中延时的一个问题

假设在函数F1中,需要等待一段时间再继续执行后续代码,
在等待过程中不影响消息触发其它函数执行,有什么办法?
感觉sleep()和WaitForSingleObject()都不行,望高手

最佳答案:

用下面的方法吧,我就是用这个的

MSG msg;
DWORD dwTimeStarted;
dwTimeStarted = ::GetTickCount();
UINT LFactor=50;    //你改这里就行了

while   (::GetTickCount() - dwTimeStarted < LFactor)  

if   (PeekMessage(&msg,0,0,0,PM_REMOVE)) 

TranslateMessage(&msg);
DispatchMessage(&msg);               
}        
}

转自:http://zhidao.baidu.com/question/43092444.html

posted @ 2012-05-26 09:05  stma  阅读(125)  评论(0)    收藏  举报