small refinements

This commit is contained in:
Christian Kroll 2012-10-17 21:56:17 +00:00
parent 95c06defac
commit d4d7aaa1cb
1 changed files with 15 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/** /**
* \defgroup winsimulator Simulation of the Borg API for the Win32 platform. * \defgroup winsimulator Simulation of the Borg API for the Win32 platform.
*/ */
/*@{*/ /*@{*/
@ -442,6 +442,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
HWND hWnd; HWND hWnd;
MSG msg; MSG msg;
HANDLE hThread; HANDLE hThread;
UINT_PTR uTimerId;
/* regster window class (with nice black background!) */ /* regster window class (with nice black background!) */
if (simRegisterWindowClass(&wc, hInstance)) if (simRegisterWindowClass(&wc, hInstance))
@ -460,10 +461,11 @@ int APIENTRY WinMain(HINSTANCE hInstance,
/* ensure that the display loop stays responsive */ /* ensure that the display loop stays responsive */
SetThreadPriority(hThread, THREAD_PRIORITY_HIGHEST); SetThreadPriority(hThread, THREAD_PRIORITY_HIGHEST);
/* issue a timer message every 40 ms (roughly 25 fps) */ /* issue a UI timer message every 40 ms (roughly 25 fps) */
/* NOTE: this has nothing to do with the multimedia timer */ /* NOTE: this has nothing to do with the multimedia timer */
SetTimer(hWnd, 23, 40, NULL); uTimerId = SetTimer(hWnd, 23, 40, NULL);
if (uTimerId != NULL)
{
/* standard Windows(R) message loop */ /* standard Windows(R) message loop */
/* (runs as long as the window hasn't been closed) */ /* (runs as long as the window hasn't been closed) */
while (GetMessageA(&msg, NULL, 0, 0)) while (GetMessageA(&msg, NULL, 0, 0))
@ -472,6 +474,10 @@ int APIENTRY WinMain(HINSTANCE hInstance,
DispatchMessageA(&msg); DispatchMessageA(&msg);
} }
/* remove that UI timer */
KillTimer(hWnd, uTimerId);
}
/* stop the display loop */ /* stop the display loop */
TerminateThread(hThread, 0); TerminateThread(hThread, 0);
} }