You can cancel an active timer event at any time. Be sure to cancel any outstanding timers before freeing the DLL containing the callback function. To cancel a timer event, use the timeKillEvent function, which has the following syntax:
UINT timeKillEvent(wTimerID)
Pass the timer ID returned by timeSetEvent to the wTimerID parameter.