这段脚本代码不知道出了什么问题,exit不起作用
这个脚本实现的功能是1,运行后,进度条自动走5秒
2,在这5秒内,退出按键不可用,最大化,最小化,关闭按键也不用
3,鼠标只能在主窗体内移动
4,5秒后,退出,最大化,最小化,关闭按键,可用
#NoTrayIcon
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
Dim $time
$time = 5
$Form1 = GUICreate("Form1", 695, 573, 180, 117)
$Edit1 = GUICtrlCreateEdit("", 8, 104, 681, 393)
GUICtrlSetData(-1, "Edit1")
$Progress1 = GUICtrlCreateProgress(0, 552, 689, 17)
$Button1 = GUICtrlCreateButton("Button1", 264, 504, 129, 33, 0)
$Pic1 = GUICtrlCreatePic("", 0, 0, 689, 100, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
GUICtrlSetState($Button1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
AdlibEnable("prog", 10 * $time)
$wait = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
close()
Case $GUI_EVENT_MINIMIZE
Case $Button1
Exit
EndSwitch
WEnd
Func prog()
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetData($Progress1, $wait)
$coor = WinGetPos($Form1)
_MouseTrap($coor, $coor, $coor + $coor, $coor + $coor)
For $s = 0 To $time Step 1
If GUICtrlRead($Progress1) = $s * 100 / $time Then GUICtrlSetData($Button1, $time - $s & "秒后退出")
Next
$wait = $wait + 1
If $wait = 101 Then disbutton()
EndFunc ;==>prog
Func disbutton()
AdlibDisable()
_MouseTrap()
GUICtrlSetState($Progress1, $GUI_DISABLE)
GUICtrlSetState($Button1, $GUI_ENABLE)
GUICtrlSetData($Button1, "退 出")
EndFunc ;==>disbutton
Func close()
If GUICtrlGetState($Button1) = $GUI_ENABLE Then Exit
EndFunc ;==>close
59行的一个自定义函数不知道出了什么问题
我的本意是,如果$button1可用,就退出,否则没有操作
但现在不管$button1是否可用 Then后面的EXIT根本不起作用
是哪里出问题啊?
[ 本帖最后由 leewger 于 2008-7-9 10:46 编辑 ] Func close()
If GUICtrlGetState($Button1) = 80 Then Exit
EndFunc ;==>close 为什么GUICtrlGetState($Button1)的值是80,而不是$GUI_ENABLE呢?
页:
[1]