Help on Waitable Timer functions
Posted: Tue Oct 12, 2004 12:03 pm
I want to use the Win32 Waitable Timer functions to set a timer and do something. The problem is that the returncodes of the functions are OK, but nothing happens. What am I doing wrong?
Code: Select all
Procedure DateToFileTime(datum,*ft.FILETIME)
st.systemtime
st\wYear=Year(datum):st\wMonth=Month(datum):st\wDay=Day(datum)
st\wHour=Hour(datum):st\wMinute=Minute(datum):st\wSecond=Second(datum):st\wMilliseconds=0
SystemTimeToFileTime_(st,*ft)
EndProcedure
Procedure TimerProc(a.l,b.l,c.l)
MessageRequester("Timer","Now started",0)
EndProcedure
hTimer.l = CreateWaitableTimer_(0,#False,"MyTimer")
If hTimer
ft.FILETIME
datum=Date(2004,10,12,13,07,00) ; set date and time for timer (within 2 minutes)
DateToFileTime(datum,ft)
success.l = SetWaitableTimer_(hTimer,ft,0,@TimerProc(),0,#False)
If success = 0
MessageRequester("Timer", GetErrorDescription(),0)
Else
Debug success
WaitForSingleObject_(hTimer,120000) ; time-out after 2 minutes (= 120.000 millisecconds)
EndIf
CloseHandle_(hTimer)
EndIf
End