Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

timeBeginPeriod function (timeapi.h)

Feedback

In this article

ThetimeBeginPeriod 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

ReturnsTIMERR_NOERROR if successful orTIMERR_NOCANDO if the resolution specified inuPeriod is out of range.

Remarks

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

You must match each call totimeBeginPeriod with a call totimeEndPeriod, specifying the same minimum resolution in both calls. An application can make multipletimeBeginPeriod calls as long as each call is matched with a call totimeEndPeriod.

Prior to Windows 10, version 2004, this function affects a global Windows setting. For all processes Windows uses the lowest value (that is, highest resolution) requested by any process. Starting with Windows 10, version 2004, this function no longer affects global timer resolution. For processes which call this function, Windows uses the lowest value (that is, highest resolution) requested by any process. For processes which have not called this function, Windows does not guarantee a higher resolution than the default system resolution.

Starting with Windows 11, if a window-owning process becomes fully occluded, minimized, or otherwise invisible or inaudible to the end user, Windows does not guarantee a higher resolution than the default system resolution. SeeSetProcessInformation for more information on this behavior.

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

RequirementValue
Minimum supported clientWindows 2000 Professional [desktop apps only]
Minimum supported serverWindows 2000 Server [desktop apps only]
Target PlatformWindows
Headertimeapi.h (include Windows.h)
LibraryWinmm.lib
DLLWinmm.dll

See also

Multimedia Timer Functions

Multimedia Timers


Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

  • Last updated on

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?