au3 ui html,Au3简单的多线程例子

c0e5eba6b29e2b4e711ab02ee1904bd1.png

$Form1 = GUICreate("多线程实例", 272, 139, -1, -1)

$Label1 = GUICtrlCreateLabel("00:00:00:00", 8, 8, 146, 17)

$Label2 = GUICtrlCreateLabel("0", 8, 56, 150, 17)

$Label3 = GUICtrlCreateLabel("", 8, 104, 148, 17)

$Button1 = GUICtrlCreateButton("关闭线程1", 168, 8, 89, 25, 0)

$Button2 = GUICtrlCreateButton("关闭线程2", 168, 48, 89, 25, 0)

$Button3 = GUICtrlCreateButton("关闭线程3", 168, 96, 89, 25, 0)

GUISetState(@SW_SHOW)

Global $t2, $t3 = 1

$Timer = DllCallbackRegister("TimerFun", "int", "hwnd;uint;uint;dword")

$TimerDLL = DllCall("user32.dll", "uint", "SetTimer", "hwnd", 0, "uint", 0, "int", 1000, "ptr", DllCallbackGetPtr($Timer))

$Timer2 = DllCallbackRegister("TimerFun2", "int", "hwnd;uint;uint;dword")

$Timer2DLL = DllCall("user32.dll", "uint", "SetTimer", "hwnd", 0, "uint", 0, "int", 1000, "ptr", DllCallbackGetPtr($Timer2))

$Timer3 = DllCallbackRegister("TimerFun3", "int", "hwnd;uint;uint;dword")

$Timer3DLL = DllCall("user32.dll", "uint", "SetTimer", "hwnd", 0, "uint", 0, "int", 500, "ptr", DllCallbackGetPtr($Timer3))

While 1

Switch GUIGetMsg()

Case - 3

Exit

Case $Button1

DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "uint", $TimerDLL)

DllCallbackFree($Timer)

Case $Button2

DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "uint", $Timer2DLL)

DllCallbackFree($Timer2)

Case $Button3

DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "uint", $Timer3DLL)

DllCallbackFree($Timer3)

EndSwitch

WEnd

Func TimerFun($hWnd, $uiMsg, $idEvent, $dwTime)

If $idEvent = $TimerDLL[0] Then

GUICtrlSetData($Label1, @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC)

ElseIf $idEvent = $Timer2DLL[0] Then

$t2 += 1

GUICtrlSetData($Label2, $t2)

ElseIf $idEvent = $Timer3DLL[0] Then

$t3 *= 2

GUICtrlSetData($Label3, $t3)

EndIf

EndFunc

Func TimerFun1($hWnd, $uiMsg, $idEvent, $dwTime)

GUICtrlSetData($Label1, @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC)

EndFunc

Func TimerFun2($hWnd, $uiMsg, $idEvent, $dwTime)

$t2 += 1

GUICtrlSetData($Label2, $t2)

EndFunc

Func TimerFun3($hWnd, $uiMsg, $idEvent, $dwTime)

$t3 *= 2

GUICtrlSetData($Label3, $t3)

EndFunc

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值