The information in this article applies to:
SUMMARYSetTimer() was not designed to be used with a console application because it requires a message loop to dispatch the timer signal to the timer procedure. In a console application, this behavior can be easily emulated with a thread that is set to wait on an event. MORE INFORMATION
In Windows NT 3.1, SetTimer() can work within a console application, but it
requires a thread in a loop calling GetMessage() and DispatchMessage().
Because this requires a thread looping, there is no real advantage to
adding a timer to a console application over using a thread waiting on an
event.
Another option is to use a multimedia timer, which does not require a message loop and has a higher resolution. In Windows NT 3.5, the resolution can be set to 1 msec using timeBeginPeriod(). See the help for timeSetEvent() and the Multimedia overview. Any application using Multimedia calls must include MMSYSTEM.H, and must link with WINMM.LIB. Additional query words:
Keywords : kbNTOS kbWinOS2000 kbSDKWin32 kbGrpUser kbWinOS95 kbWinOS98 kbWndw kbWndwMsg |
Last Reviewed: February 3, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |