The timeSetEvent function starts a specified timer event. The multimedia timer runs in its own thread. After the event is activated, it calls the specified callback function or sets or pulses the specified event object.
MMRESULT timeSetEvent(
UINT uDelay,
UINT uResolution,
LPTIMECALLBACK lpTimeProc,
DWORD dwUser,
UINT fuEvent
);
Value | Meaning |
---|---|
TIME_ONESHOT | Event occurs once, after uDelay milliseconds. |
TIME_PERIODIC | Event occurs every uDelay milliseconds. |
The fuEvent parameter may also include one of the following values:
Value | Meaning |
---|---|
TIME_CALLBACK_FUNCTION | When the timer expires, Windows calls the function pointed to by the lpTimeProc parameter. This is the default. |
TIME_CALLBACK_EVENT_SET | When the timer expires, Windows calls the SetEvent function to set the event pointed to by the lpTimeProc parameter. The dwUser parameter is ignored. |
TIME_CALLBACK_EVENT_PULSE | When the timer expires, Windows calls the PulseEvent function to pulse the event pointed to by the lpTimeProc parameter. The dwUser parameter is ignored. |
Returns an identifier for the timer event if successful or an error otherwise. This function returns NULL if it fails and the timer event was not created. (This identifier is also passed to the callback function.)
Each call to timeSetEvent for periodic timer events requires a corresponding call to the timeKillEvent function.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
Multimedia Timers Overview, Multimedia Timer Functions, PulseEvent, SetEvent, timeKillEvent