{************************************************************}
{ }
{ TimerQueue }
{ }
{ Copyright (c) 2004 Michael Puff }
{ }
{ When I die I want 'Hello, world' carved on my headstone. }
{ }
{************************************************************}
unit TimerQueue;
interface
type
THandle = Cardinal;
DWORD = Cardinal;
ULONG = Cardinal;
BOOL = Boolean;
const
WT_EXECUTEDEFAULT = $00000000;
WT_EXECUTEINIOTHREAD = $00000001;
WT_EXECUTEINUITHREAD = $00000002;
WT_EXECUTEINWAITTHREAD = $00000004;
WT_EXECUTEONLYONCE = $00000008;
WT_EXECUTEINTIMERTHREAD = $00000020;
WT_EXECUTELONGFUNCTION = $00000010;
WT_EXECUTEINPERSISTENTIOTHREAD = $00000040;
WT_EXECUTEINPERSISTENTTHREAD = $00000080;
WT_TRANSFER_IMPERSONATION = $00000100;
type
WAITORTIMERCALLBACKFUNC =
procedure(P: Pointer; B: ByteBool);
stdcall;
WAITORTIMERCALLBACK = WAITORTIMERCALLBACKFUNC;
function CreateTimerQueue: THandle;
stdcall;
function CreateTimerQueueTimer(
var phNewTimer: THandle; TimerQueue: THandle;
Callback: WAITORTIMERCALLBACK; Parameter: Pointer; DueTime, Period: DWORD;
Flags: ULONG): BOOL;
stdcall;
function ChangeTimerQueueTimer(TimerQueue: THandle; Timer: THandle; DueTime:
ULONG; Period: ULONG): Boolean;
stdcall;
function DeleteTimerQueueTimer(TimerQueue, Timer, CompletionEvent: THandle):
BOOL;
stdcall;
function DeleteTimerQueueEx(TimerQueue: THandle; CompletionEvent: THandle):
Boolean;
implementation
function CreateTimerQueue;
external '
kernel32.dll'
name '
CreateTimerQueue';
function CreateTimerQueueTimer;
external '
kernel32.dll'
name
'
CreateTimerQueueTimer';
function ChangeTimerQueueTimer;
external '
kernel32.dll'
name
'
ChangeTimerQueueTimer';
function DeleteTimerQueueTimer;
external '
kernel32.dll'
name
'
DeleteTimerQueueTimer';
function DeleteTimerQueueEx;
external '
kernel32.dll'
name '
DeleteTimerQueueEx';
end.