本帖最后由 lin6051 于 2017-10-11 20:18 编辑
GUICreate('test', 200, 100)
$button1 = GUICtrlCreateButton('start', 50, 50)
$button2 = GUICtrlCreateButton('stop', 150, 50)
GUISetState()
GUIRegisterMsg(0x111, '_WM_COMMAND')
GUIRegisterMsg(0x112, '_WM_SYSCOMMAND')
Dim $a = 1
While 1
$msg = GUIGetMsg()
Switch $msg
Case $button1
test()
EndSwitch
WEnd
Func Button_2()
Exit MsgBox(0, '', 'a=' & $a)
EndFunc ;==>Button_2
Func test()
For $i = 1 To 999999
Sleep(999)
$a += 1
Next
EndFunc ;==>test
Func _WM_COMMAND($hWnd, $msg, $wParam, $lParam)
Switch BitAND($wParam, 0x0000FFFF)
Case $button2
Button_2()
EndSwitch
EndFunc ;==>_WM_COMMAND
Func _WM_SYSCOMMAND($hWnd, $msg, $wParam, $lParam)
Switch $wParam
Case 0xF060
Button_2()
EndSwitch
EndFunc ;==>_WM_SYSCOMMAND
|