找回密码
 加入
搜索
查看: 2896|回复: 4

[AU3基础] 请高手指点几个小问题。。 感谢中。。。[已解决]

  [复制链接]
发表于 2010-3-6 10:35:32 | 显示全部楼层 |阅读模式
本帖最后由 tzz365 于 2010-3-6 12:05 编辑

谢谢rolaka 帮助。 问题1:GUI1倒计时结束后无法运行下面程序。
问题2:GUI2选择取消。  在次运行GUI1确定。 没有反映。
请求高手指点。
Global $time = 30
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("test", 350, 172, 193, 125)
$gaway1 = GUICtrlCreateLabel("test", 107, 15, 120, 17)
GUICtrlSetFont(-1, 15, 400, 0, "楷体_GB2312")
$Label1 = GUICtrlCreateLabel("30秒后test!", 1, 50, 400, 28)
GUICtrlSetFont(-1, 12, 400, 0, "楷体_GB2312")
$Progress1 = GUICtrlCreateProgress(8, 88, 333, 17)
$Button1 = GUICtrlCreateButton("确定(&Y)", 53, 128, 73, 25, 0)
$Button2 = GUICtrlCreateButton("退出(&X)", 210, 128, 73, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AdlibRegister("_timer", 1000)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE, $Button2
                        Exit
                Case $Button1
$Form2 = GUICreate("你好世界", 200, 100)
GUICtrlCreateLabel("你好世界!你好么?", 30, 10)
$okbutton1 = GUICtrlCreateButton("取消", 20, 50, 60)
$okbutton2 = GUICtrlCreateButton("确定", 120, 50, 60)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()

  Select
    Case $msg = $okbutton1
        GUISwitch($Form2)
        GUISetState(@SW_HIDE)
        GUISwitch($Form1)
        GUISetState(@SW_SHOW)
    Case $msg = $okbutton2
$okbutton2 = $Button1
      ExitLoop
  EndSelect
WEnd
                        ExitLoop
        EndSwitch
        If $time <= 0 Then ExitLoop
WEnd
main()
Exit

Func _timer()
        $time -= 1
        GUICtrlSetData($Label1, $time & "秒后test!")
        GUICtrlSetData($Progress1, (30 - $time) / 0.3)
        If $time <= 0 Then AdlibUnRegister()
EndFunc   ;==>_timer

Func main()
Run("D:\Program Files\Tencent\QQ\Bin\QQ.exe");启动qq

EndFunc   ;==>main

评分

参与人数 1金钱 -20 贡献 -1 收起 理由
afan -20 -1 重复违规http://www.autoitx.com/redirect. ...

查看全部评分

发表于 2010-3-6 10:52:55 | 显示全部楼层
= = 真的没看懂你在写什么.......................

$okbutton2是干吗的?

不负责任的改了下 整个程序里最好不要用两个while 除非你明确知道程序执行流程
Global $time = 30
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("test", 350, 172, 193, 125)
$gaway1 = GUICtrlCreateLabel("test", 107, 15, 120, 17)
GUICtrlSetFont(-1, 15, 400, 0, "楷体_GB2312")
$Label1 = GUICtrlCreateLabel("30秒后test!", 1, 50, 400, 28)
GUICtrlSetFont(-1, 12, 400, 0, "楷体_GB2312")
$Progress1 = GUICtrlCreateProgress(8, 88, 333, 17)
$Button1 = GUICtrlCreateButton("确定(&Y)", 53, 128, 73, 25, 0)
$Button2 = GUICtrlCreateButton("退出(&X)", 210, 128, 73, 25, 0)
GUISetState(@SW_SHOW)
$Form2 = GUICreate("你好世界", 200, 100)
GUICtrlCreateLabel("你好世界!你好么?", 30, 10)
$okbutton1 = GUICtrlCreateButton("取消", 20, 50, 60)
$okbutton2 = GUICtrlCreateButton("确定", 120, 50, 60)
#EndRegion ### END Koda GUI section ###
AdlibRegister("_timer", 1000)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE, $Button2
                        Exit
                Case $Button1
                        GUISetState(@SW_SHOW, $Form2)
                Case $okbutton1
                        GUISwitch($Form2)
                        GUISetState(@SW_HIDE)
                        GUISwitch($Form1)
                        GUISetState(@SW_SHOW)
                Case $okbutton2
                        $okbutton2 = $Button1
                        ExitLoop
        EndSwitch
        If $time <= 0 Then ExitLoop
WEnd

main()
Exit

Func _timer()
        $time -= 1
        GUICtrlSetData($Label1, $time & "秒后test!")
        GUICtrlSetData($Progress1, (30 - $time) / 0.3)
        If $time <= 0 Then AdlibUnRegister()
EndFunc   ;==>_timer

Func main()
        Run("D:\Program Files\Tencent\QQ\Bin\QQ.exe");
EndFunc   ;==>main

Exit
 楼主| 发表于 2010-3-6 11:27:46 | 显示全部楼层
回复 2# rolaka


    高手在问个小问题。 打开程序时候。 默认是确定按扭。 要使用什么命令让它默认是退出。
发表于 2010-3-6 11:37:28 | 显示全部楼层
$Button2 = GUICtrlCreateButton("退出(&X)", 210, 128, 73, 25, 0)
$Button1 = GUICtrlCreateButton("确定(&Y)", 53, 128, 73, 25, 0)
创建顺序换下就可以了0 0

也可以
GUICtrlSetState($Button2, $GUI_FOCUS) 
发表于 2010-3-6 11:43:57 | 显示全部楼层
楼主这是连续3次了,屡次不改。准备接受结果吧!也请热情的网友不要回复此类不规范标题的帖子,以免受牵连。

标题模糊|违规,不利于论坛搜索,此主题已暂时关闭。请依照论坛发帖规则修改标题。并于修改合格之后,联系本版版主或管理员打开(务必附上被关闭的帖子链接)。若3日后仍未修改,将移入论坛回收站。若放弃对此主题的修改而重新开贴,将删除新帖并从重处罚。

附:论坛发帖规则 http://www.autoitx.com/forum.php?mod=viewthread&tid=10945
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-13 23:50 , Processed in 0.086403 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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