No issues with Freebasic:
#include "windows.bi"
#include "win/winbase.bi"
Sub WoTCallback(LPARAM As LPARAM, TimerOrWaitFired As BOOL)
? LPARAM, TimerOrWaitFired
End Sub
Dim As PHANDLE phNewTimer
Dim As HANDLE hTQ = CreateTimerQueue()
CreateTimerQueueTimer(@phNewTimer, hTQ, Cast(WAITORTIMERCALLBACK, @WoTCallback), 0, 100, 100, WT_EXECUTEDEFAULT)
Dim As Double t = Timer
While 1
If Timer - t > 5 Then
? !"Exit loop"
DeleteTimerQueueTimer(hTQ, phNewTimer, 0)
CloseHandle(phNewTimer)
Exit While
End If
Sleep(10)
Wend
Sleep
Seems to be an issue with Autoit.
Edit:
Local $a_hCall = DllCall("kernel32.dll", "bool", "CreateTimerQueueTimer", _
"struct*", $tBuffer, _
"handle", $a_h_CreateTimerQueue[0], _
"ptr", DllCallbackGetPtr($hCallback), _
"ptr", Null, _
"dword", 5000, _
"dword", $i_TimerQueue_Repeat_after, _
"ulong", 0)
This seems to be stable.