仙乃日 发表于 2020-9-24 22:21:40

定时器模拟多线程

Local $Timer = DllCallbackRegister("_Timer", "int", "hwnd;uint;uint;dword")
Local $TimerDLL = DllCall("user32.dll", "uint", "SetTimer", "hwnd", 0, "uint", 9, "int", 10, "ptr", DllCallbackGetPtr($Timer))
                                                  ;返回值:类型:UINT_PTR             hWnd参数为0,则返回新建立的时钟编号
MsgBox(0, "双重提示:", "测试",3)
DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "uint", $TimerDLL)
DllCallbackFree($Timer)
Func _Timer($hWnd, $uiMsg, $idEvent, $dwTime)
        If $idEvent = $TimerDLL Then
                Beep(420,3000)
        EndIf
EndFunc   ;==>Timer

yihengyeaa 发表于 2020-9-25 02:54:46

看下大佬写的高级代码

zm9799 发表于 2023-11-12 10:54:23

定时器模拟多线程,收藏学习
页: [1]
查看完整版本: 定时器模拟多线程