The CreateTimerQueueTimer function creates a timer-queue timer. This timer expires at the specified due time, then after every specified period. When the timer expires, the callback function is called.
Declare Function CreateTimerQueueTimer Lib "kernel32.dll" (ByRef phNewTimer As Long, ByVal TimerQueue As Long, ByVal Callback As Long, ByVal Parameter As Long, ByVal DueTime As Long, ByVal Period As Long, ByVal Flags As Long) As Long
|Operating Systems Supported|
|Requires Windows 2000 or later; Win9x/ME: Not supported|
|· phNewTimer |
[out] Pointer to a buffer that receives a handle to the timer-queue timer on return.
[in] Handle to a timer queue. This handle is returned by the CreateTimerQueue function.
If this parameter is NULL, the timer is associated with the default timer queue.
[in] Pointer to the application-defined function of type WAITORTIMERCALLBACK to be executed when the timer expires. For more information, see WaitOrTimerCallback.
[in] Specifies a single parameter value that will be passed to the callback function.
[in] Specifies the amount of time, in milliseconds, to elapse before the timer is to be set to the signaled state for the first time.
[in] Specifies the period of the timer, in milliseconds. If this parameter is zero, the timer is signaled once. If this parameter is greater than zero, the timer is periodic. A periodic timer automatically reactivates each time the period elapses, until the timer is canceled.
[in] This parameter can be one or more of the following values.
The callback function is invoked by the timer thread itself. This flag should be used only for short tasks or it could affect other timer operations.
The callback function is queued to an I/O worker thread. This flag should be used if the function should be executed in a thread that waits in an alertable state.
The callback function is queued as an APC. Be sure to address reentrancy issues if the function performs an alertable wait operation.
The callback function is queued to a thread that never terminates. This flag should be used only for short tasks or it could affect other timer operations.
Note that currently no worker thread is persistent, although no worker thread will terminate if there are any pending I/O requests.
Specifies that the callback function can perform a long wait. This flag helps the system to decide if it should create a new thread.
The timer will be set to the signaled state only once.
|If the function succeeds, the return value is nonzero.|
If the function fails, the return value is zero. To get extended error information, call GetLastError.