程序启动快捷键后窗口无法退出!
本帖最后由 那片叶子 于 2009-10-29 00:52 编辑#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $Paused
$Form1 = GUICreate("测试窗口", 232, 88, 192, 114)
$Button1 = GUICtrlCreateButton("测试 按 钮", 56, 32, 113, 25, 0)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
HotKeySet("{F1}", "qidong");启动鼠标连点
HotKeySet("{End}", "zhanting");暂停鼠标连点
EndSwitch
WEnd
Func zhanting()
$Paused = True
TogglePause()
EndFunc
Func TogglePause()
While $Paused
Sleep(100)
ToolTip('暂停鼠标连点', 0, 0)
WEnd
EndFunc
Func qidong()
ToolTip("")
While 1
MouseClick("left")
WEnd
EndFunc如上,我点击界面按钮后启动快捷键! 未启动时,测试窗口可以关闭, 按F1启动后,暂停,就无法关闭测试窗口,请各位帮忙看下!谢谢了! While 除非调用 ExitLoop ,否则无限循环.是不是这样啊??????????............ 本帖最后由 newx 于 2009-10-29 00:45 编辑
Func qidong()
ToolTip("")
While 1
MouseClick("left")
WEnd
EndFunc
这段代码(启动后),一直在循环MouseClick("left"),可没有退出循环的语句呀
解决:中间加个判断的语句,以执行退出循环
HotKeySet("{ESC}", ExitLoop) Func qidong()
ToolTip("")
While 1
MouseClick("left")
WEnd
EndFunc
这段代码(启动后),一直在循环MouseClick("left"),可没有退出循环的语句呀
解决:中间加个 ...
newx 发表于 2009-10-29 00:42 http://www.autoitx.com/images/common/back.gif
:face (37):谢谢大大!! 改了一下#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $Paused
$Form1 = GUICreate("测试窗口", 232, 88, 192, 114)
$Button1 = GUICtrlCreateButton("测试 按 钮", 56, 32, 113, 25, 0)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
HotKeySet("{F1}", "qidong");启动鼠标连点
HotKeySet("{End}", "zhanting");暂停鼠标连点
HotKeySet("{ESC}", "nExit");暂停鼠标连点
EndSwitch
WEnd
Func zhanting()
$Paused = True
TogglePause()
EndFunc
Func TogglePause()
While $Paused
Sleep(100)
ToolTip('暂停鼠标连点', 0, 0)
WEnd
EndFunc
Func qidong()
ToolTip("")
While 1
MouseClick("left")
WEnd
EndFunc
Func nExit()
Exit
EndFunc 貌似按了ESC就退出了! 能否不让其退出! :face (31): 弄了个很笨的方法!
Func qidong()
Global $P=0
While $p=0
MouseClick("left")
WEnd
EndFunc
对while 负值 ,然后按下热键对其再次负值
Func zhanting()
$p=1
EndFunc
While 表达式说明:若该表达式的值为true(真)则重复执行循环体语句(以WEnd为结束标志),否则循环结束. Func nExit()
Exit
EndFunc
改为:
Func nExit()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
HotKeySet("{F1}", "qidong");启动鼠标连点
HotKeySet("{End}", "zhanting");暂停鼠标连点
HotKeySet("{ESC}", "nExit");暂停鼠标连点
EndSwitch
WEnd
EndFunc
页:
[1]