Timer Resolution
[The feature associated with this page, Multimedia Timers, is a legacy feature. It has been superseded by Multimedia Class Scheduler Service. Multimedia Class Scheduler Service has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Multimedia Class Scheduler Service instead of Multimedia Timers, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
To determine the minimum and maximum timer resolutions supported by the timer services, use the timeGetDevCaps function. This function fills the wPeriodMin and wPeriodMax members of the TIMECAPS structure with the minimum and maximum resolutions. This range can vary across computers and Windows platforms.
After you determine the minimum and maximum available timer resolutions, you must establish the minimum resolution you want your application to use. Use the timeBeginPeriod and timeEndPeriod functions to set and clear this resolution. You must match each call to timeBeginPeriod with a call to timeEndPeriod, specifying the same minimum resolution in both calls. An application can make multiple timeBeginPeriod calls, as long as each call is matched with a call to timeEndPeriod.
In both timeBeginPeriod and timeEndPeriod, the uPeriod parameter indicates the minimum timer resolution, in milliseconds. You can specify any timer resolution value within the range supported by the timer.
Related topics