Establishing Minimum Timer Resolution

Before starting timer events, your application must establish the minimum timer resolution that it intends to use. It must clear this value after finishing with the timer-event services.

Use the timeBeginPeriod and timeEndPeriod functions to set and clear the minimum timer-event resolution for your application. You must match a call to timeBeginPeriod with a corresponding 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.

The timeBeginPeriod function has the following syntax:

void timeBeginPeriod(wMinRes)

The timeEndPeriod function has the following syntax:

void timeEndPeriod(wMinRes)

In both functions, the wMinRes parameter indicates the minimum timer resolution in milliseconds. You can specify any resolution value within the range of resolution values supported by the timer. The wPeriodMin and wPeriodMax fields of the TIMECAPS structure (filled by the timeGetDevCaps function) specify the minimum and maximum resolution supported by the timer services.