Re: Console example - WeOnlyDo Discussion board

Re: Console example (General questions)

by Hans, Thursday, January 04, 2007, 22:38 (6531 days ago) @ Hans

Even easier:
[code]void XSleep(DWORD dwWaitInMSecs)
{
DWORD dwStopTime = GetTickCount() + dwWaitInMSecs;
DWORD dwTimeout = dwWaitInMSecs;
MSG msg;

while(1) {
switch(MsgWaitForMultipleObjects(0, NULL, FALSE, dwTimeout, QS_ALLINPUT)) {
case WAIT_TIMEOUT: break;
default:
while(::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
}
dwTimeout = dwStopTime - GetTickCount();
if(!dwTimeout || dwTimeout>dwWaitInMSecs) break;
}
}[/code]


Complete thread: