This topic has not yet been rated - Rate this topic

timeBeginPeriod function

Applies to: desktop apps only

The timeBeginPeriod function requests a minimum resolution for periodic timers.

Syntax

MMRESULT timeBeginPeriod(
  UINT uPeriod
);

Parameters

uPeriod

Minimum timer resolution, in milliseconds, for the application or device driver. A lower value specifies a higher (more accurate) resolution.

Return value

Returns TIMERR_NOERROR if successful or TIMERR_NOCANDO if the resolution specified in uPeriod is out of range.

Remarks

Call this function immediately before using timer services, and call the timeEndPeriod function immediately after you are finished using the timer services.

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.

This function affects a global Windows setting. Windows uses the lowest value (that is, highest resolution) requested by any process. Setting a higher resolution can improve the accuracy of time-out intervals in wait functions. However, it can also reduce overall system performance, because the thread scheduler switches tasks more often. High resolutions can also prevent the CPU power management system from entering power-saving modes. Setting a higher resolution does not improve the accuracy of the high-resolution performance counter.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Mmsystem.h (include Windows.h)

Library

Winmm.lib

DLL

Winmm.dll

See also

Multimedia Timers
Multimedia Timer Functions

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Match with timeEndPeriod only on success?
A small clarification: if timeBeginPeriod() returns TIMERR_NOCANDO, must you still call timeEndPeriod()?