找回密码
 加入
搜索
查看: 1514|回复: 2

[AU3基础] 设置暂停和继续的代码

[复制链接]
发表于 2010-10-17 18:57:45 | 显示全部楼层 |阅读模式
请问个位大虾个问题,小弟刚学习autoit不久,在做一个小程序的时候需要设置暂停和继续的热键,但是不知道怎么写这一段程序,各位大虾可否帮忙看看。
例如F1是暂停 F2是继续

谢谢各位了
 楼主| 发表于 2010-10-17 19:18:31 | 显示全部楼层
没有人回吗?在线等啊~~
发表于 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金钱 +20 收起 理由
afan + 20

查看全部评分

您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-21 19:43 , Processed in 0.104154 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表