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

这段脚本代码不知道出了什么问题,exit不起作用

[复制链接]
发表于 2008-6-15 18:58:51 | 显示全部楼层 |阅读模式
这个脚本实现的功能是
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[0], $coor[1], $coor[0] + $coor[2], $coor[1] + $coor[3])

        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 编辑 ]
发表于 2008-6-15 19:16:18 | 显示全部楼层
[au3]Func close()       
        If GUICtrlGetState($Button1) = 80 Then Exit
EndFunc   ;==>close[/au3]
 楼主| 发表于 2008-6-15 21:33:19 | 显示全部楼层
为什么GUICtrlGetState($Button1)的值是80,而不是$GUI_ENABLE呢?
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-19 03:51 , Processed in 0.068262 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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