Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


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

Terms of Use
Privacy Policy
CreateTimerQueue (kernel32)
 
.
Summary

C# Signature:

[DllImport("kernel32.dll")]
static extern bool CreateTimerQueueTimer(out IntPtr phNewTimer,
   IntPtr TimerQueue, WaitOrTimerDelegate Callback, IntPtr Parameter,
   uint DueTime, uint Period, uint Flags);

VB.NET Signature:

<DllImport("kernel32.dll")> _
Private Shared Function CreateTimerQueueTimer(ByRef phNewTimer As IntPtr, TimerQueue As IntPtr, Callback As WaitOrTimerDelegate, Parameter As IntPtr, DueTime As UInteger, Period As UInteger, _
     Flags As UInteger) As Boolean
End Function

User-Defined Types:

Delegate:

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

Enum:

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>
    WT_EXECUTEINTIMERTHREAD = 0x00000020,
    /// <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>
    WT_EXECUTEINPERSISTENTTHREAD = 0x00000080,

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

    /// <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>
    WT_TRANSFER_IMPERSONATION = 0x00000100

};

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Alternative Managed API:

timeSetEvent

Do you know one? Please contribute it!

Documentation

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 PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions