zhongxinily 发表于 2010-10-17 18:57:45

设置暂停和继续的代码

请问个位大虾个问题,小弟刚学习autoit不久,在做一个小程序的时候需要设置暂停和继续的热键,但是不知道怎么写这一段程序,各位大虾可否帮忙看看。
例如F1是暂停 F2是继续

谢谢各位了

zhongxinily 发表于 2010-10-17 19:18:31

没有人回吗?在线等啊~~

xianhou 发表于 2010-10-17 19:47:31

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 341, 302, 192, 114)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Button1 = GUICtrlCreateButton("暂停", 32, 168, 120, 60)
GUICtrlSetOnEvent(-1, "Button1Click")
$Button2 = GUICtrlCreateButton("继续", 184, 168, 120, 60)
GUICtrlSetOnEvent(-1, "Button2Click")
$Input1 = GUICtrlCreateInput("Input1", 80, 72, 193, 21)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Local $i, $j
$j = 1

$i = 0
While 1
        Sleep(1000)
        If $j = 1 Then
                $i += 1
                GUICtrlSetData($Input1, $i)
        EndIf

WEnd

Func Button1Click()
        $j = 0
EndFunc   ;==>Button1Click
Func Button2Click()
        $j = 1
EndFunc   ;==>Button2Click
Func Form1Close()
        Exit
EndFunc   ;==>Form1Close
页: [1]
查看完整版本: 设置暂停和继续的代码