Using Timers

SetTimer creates timers and sets their parameters. A timer is identified by its associated window and an integer value that is unique for the given window. After a timer is created, it will generate timer events until the timer is destroyed. Timers are automatically freed when the application exits.

The period between timer events of a given timer is known as its firing interval. Although the firing interval is specified in milliseconds, the precision of the timer's firing interval is limited by the precision of the system clock. For more precise resolution, use performance monitor counters (explained later in this chapter) instead.

Listing 24.1 shows the code necessary to create and use a timer. A unique identifier, MY_TIMER (value ...

Get Microsoft Windows 2000 API SuperBible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.