timeSetEvent  2JJ7_U9 

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.

MMRESULT timeSetEvent(

    UINT uDelay,

 

    UINT uResolution,

 

    LPTIMECALLBACK lpTimeProc,

 

    DWORD dwUser,

 

    UINT fuEvent

 

   );

 

 

Parameters

uDelay

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

Resolution of the timer event, in milliseconds. The resolution increases with smaller values; a resolution of 0 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.

lpTimeProc

Address of a callback function that is called once upon expiration of a single event or periodically upon expiration of periodic events.

dwUser

User-supplied callback data.

fuEvent

Timer event type. The following values are defined:

TIME_ONESHOT

Event occurs once, after uDelay milliseconds.

TIME_PERIODIC

Event occurs every uDelay milliseconds.

 

Return Values

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.)

Remarks

Each call to timeSetEvent for periodic timer events must be matched with a call to the timeKillEvent function.

See Also

timeKillEvent