Desktop Functions:

   Smart Device Functions:

Show Recent Changes
Subscribe (RSS)
Misc. Pages
Helpful Tools
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
CreateTimerQueueTimer (kernel32)

C# Signature:

static extern bool CreateTimerQueueTimer(out IntPtr phNewTimer,
   IntPtr TimerQueue, WaitOrTimerDelegate Callback, IntPtr Parameter,
   uint DueTime, uint Period, uint Flags);

User-Defined Types:


public delegate void WaitOrTimerDelegate (IntPtr lpParameter, bool TimerOrWaitFired);


public enum ExecuteFlags


    /// <summary>
    /// By default, the callback function is queued to a non-I/O worker thread.
    /// </summary>
    WT_EXECUTEDEFAULT = 0x00000000,
    /// <summary>
    /// 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 as an APC. It should not perform alertable wait operations.
    /// </summary>
    /// <summary>
    /// 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.
    /// </summary>
    WT_EXECUTEINIOTHREAD = 0x00000001,

    /// <summary>
    /// The callback function is queued to a thread that never terminates. It does not guarantee that the same thread is used each time. This flag should be used only for short tasks or it could affect other timer operations.
    /// Note that currently no worker thread is truly persistent, although no worker thread will terminate if there are any pending I/O requests.
    /// </summary>

    /// <summary>
    /// The callback function can perform a long wait. This flag helps the system to decide if it should create a new thread.
    /// </summary>

    /// <summary>
    /// The timer will be set to the signaled state only once. If this flag is set, the Period parameter must be zero.
    /// </summary>
    WT_EXECUTEONLYONCE = 0x00000008,
    /// <summary>
    /// Callback functions will use the current access token, whether it is a process or impersonation token. If this flag is not specified, callback functions execute only with the process token.
    /// Windows XP/2000:  This flag is not supported until Windows XP with SP2 and Windows Server 2003.
    /// </summary>




Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Alternative Managed API:


Do you know one? Please contribute it!


Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

Access directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version