ulong set_timer(handle window, ulong identity, unsigned timeout, timer_procedure procedure=null)
This function sets a timer for a window or the thread.
The handle of the window with which the timer is associated. If null is specified, no window is associated with the timer and the next parameter is ignored.
A non-zero identity that is assigned to the timer. If the previous parameter is null, this parameter is ignored.
The interval (in milliseconds) that elapses prior to the timer timing out.
A pointer to a timer function that is called upon completion of the timeout period. If null is specified, a timer message is posted to the queue associated with the given window handle.
An integer that identifies the timer that was started or zero if an error occurred. If the timer is to be cancelled, this value may be passed to the function cancel_timer.
The timer call back function is called only when the message message::timer is passed to the default window procedure. Therefore, timer messages need to be read from the queue and dispatched in order for the timer call back to be executed.