timeSetEvent (Windows CE 5.0)
This function starts a specified timer event.
MMRESULT timeSetEvent(UINT uDelay,UINT uResolution,LPTIMECALLBACK fptc,DWORD dwUser, UINT fuEvent);
Parameters
uDelay
[in] Event delay, in milliseconds.If this value is not in the range of the minimum and maximum event delays supported by the timer, the function returns an error.
uResolution
[in] Resolution of the timer event, in milliseconds.The resolution increases with smaller values; a resolution of zero indicates periodic events should occur with the greatest possible accuracy. To reduce system overhead, however, you should use the maximum value appropriate for your application.
fptc
[in] Pointer to a callback function that is called once on expiration of a single event or periodically on expiration of periodic events.If fuEvent specifies the TIME_CALLBACK_EVENT_SET or TIME_CALLBACK_EVENT_PULSE flag, and then the lpTimeProc parameter is interpreted as a handle to an event object. The event will be set or pulsed on completion of a single event or periodically on completion of periodic events.
For any other value of fuEvent, the lpTimeProc parameter is interpreted as a function pointer.
The following code example shows the signature for the function pointer.
typedef void (CALLBACK TIMECALLBACK)(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
typedef TIMECALLBACK FAR *LPTIMECALLBACK;
dwUser
[in] User-supplied callback data.fuEvent
[in] Timer event type.The following table shows the values that can be included by the fuEvent parameter.
Value Description TIME_ONESHOT Event occurs once, after uDelay milliseconds. TIME_PERIODIC Event occurs every uDelay milliseconds. TIME_CALLBACK_FUNCTION When the timer expires, the system calls the function pointed to by the lpTimeProc parameter. This is the default value.
TIME_CALLBACK_EVENT_SET When the timer expires, the system 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, the system calls PulseEvent function to pulse the event pointed to by the lpTimeProc parameter. The dwUser parameter is ignored.
TIME_KILL_SYNCHRONOUS Passing this flag prevents an event from occurring after the timeKillEvent function is called.
Return Values
Returns an identifier for the timer event, if successful; otherwise, an error is returned.
This function returns NULL if it fails and the timer event was not created.
This identifier is passed to the callback function.
Remarks
Each call to timeSetEvent for periodic timer events requires a corresponding call to the timeKillEvent function.
Creating an event with the TIME_KILL_SYNCHRONOUS and the TIME_CALLBACK_FUNCTION flags prevents the event from occurring after the timeKillEvent function is called.
Requirements
OS Versions: Windows CE .NET 4.2 and later.
Header: Mmsystem.h.
Link Library: Mmtimer.lib.
See Also
SetEvent | PulseEvent | timeKillEvent | Time Reference
Send Feedback on this topic to the authors