Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/30/2025 in all areas

  1. Nine

    CreateTimerQueueTimer

    Does not work, it make it worst in fact, because it will create threads. ps. If anybody wants another proof, just replace the while loop by a MsgBox, it will run forever without any issue. Attempt after attempt.
    1 point
  2. UEZ

    CreateTimerQueueTimer

    You are right. What about: Local $tBuffer = DllStructCreate("handle buffer") ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms682485(v=vs.85).aspx Local $a_hCall = DllCall("kernel32.dll", "bool", "CreateTimerQueueTimer", _ "struct*", $tBuffer, _ "handle", 0, _ "ptr", DllCallbackGetPtr($hCallback), _ "ptr", Null, _ "dword", 100, _ "dword", 150, _ "ulong", 0) ... Local $a_hCall = DllCall("kernel32.dll", "bool", "DeleteTimerQueueTimer", _ "handle", 0, _ "handle", $tBuffer.buffer, _ "handle", 0) Forget: it still doesn't seem to be stable.
    1 point
  3. UEZ

    CreateTimerQueueTimer

    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.
    1 point
  4. Numeric1

    CreateTimerQueueTimer

    Combining WT_EXECUTELONGFUNCTION and WT_EXECUTEINTIMERTHREAD is technically possible but not recommended. WT_EXECUTEINTIMERTHREAD is for short tasks, and long tasks (allowed by WT_EXECUTELONGFUNCTION) may disrupt other timers via APCs. Use WT_EXECUTEDEFAULT for better stability. Best regards,
    1 point
  5. Nine

    CreateTimerQueueTimer

    I think I have found the source of the issue. As described in the function : WT_EXECUTEINTIMERTHREAD 0x00000020 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. APC : Asynchronous Procedure Call. Which means it is not executed immediately. I thought that using Volatile would help, but it does not.
    1 point
×
×
  • Create New...