找回密码
 加入
搜索
查看: 2680|回复: 11

创建一个GUI,在一定时间内退出,不影响关闭程序

 火.. [复制链接]
发表于 2010-1-12 22:32:18 | 显示全部楼层 |阅读模式
如题,比如创建个gui,30秒后关闭,不能多线程or进程,也不能用sleep(除非必要,但不能影响$GUI_EVENT_CLOSE或其它GUIMsg),要如何写呢?

算是考考新人
发表于 2010-1-12 22:41:19 | 显示全部楼层
回复 1# kn007
GUICreate('30s Gui')
GUISetState()
$ts = TimerInit()
While TimerDiff($ts) / 1000 <= 30
        Switch GUIGetMsg()
                Case -3
                        Exit
        EndSwitch
WEnd
发表于 2010-1-12 22:51:56 | 显示全部楼层
GUICreate('30s Gui')
GUISetState()
AdlibRegister("is30",3000)
$n=0
While 1
        Switch GUIGetMsg()
                Case -3
                        Exit
        EndSwitch
WEnd
Func is30()
        If $n=10 Then Exit
        $n+=1
EndFunc
        
发表于 2010-1-12 22:57:45 | 显示全部楼层
#include <GUIConstantsEx.au3>
GUICreate('test')
GUISetState()
AdlibRegister("_exit", 30000)
While 1
        Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
WEnd

Func _exit ()
        Exit
EndFunc
发表于 2010-1-12 23:09:49 | 显示全部楼层
#include <GUIConstantsEx.au3>
#include <Date.au3>
GUICreate('test')
GUISetState()
$Str = _NowCalc()
While 1
        If _DateDiff('s', $Str, _NowCalc()) = 30 Then Exit
        Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
WEnd
发表于 2010-1-13 07:19:48 | 显示全部楼层
呵呵,方法不少。
发表于 2010-1-14 00:04:09 | 显示全部楼层
这么多的方法,学习了。
发表于 2010-1-14 15:55:11 | 显示全部楼层
本帖最后由 gapkiller 于 2010-1-14 15:56 编辑

我就要用sleep,怎么滴...
Opt("GUIOnEventMode", 1)
GUICreate('30s Gui')
GUISetOnEvent(-3, "Quit")
GUISetState()
sleep(30000)

Func Quit()
    Exit
EndFunc
; 我顶2楼
发表于 2010-1-14 16:04:42 | 显示全部楼层
把那个msgbox中的settimer api移植一下
发表于 2010-1-15 10:54:46 | 显示全部楼层
真的是各有各招
发表于 2010-1-15 11:25:03 | 显示全部楼层
我的想法是把那个30秒,分成1500个20毫秒,20毫秒一个循环,1500个循环之后就退出gui,所以不会影响其他的操作啦。。。除非你能手动在20毫秒之内进行一次以上的键盘鼠标操作。。。
发表于 2010-1-15 11:28:24 | 显示全部楼层
除非你能手动在20毫秒之内进行一次以上的键盘鼠标操作

很容易吧...

再说,程序运行也需要时间滴...不准确
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-22 14:29 , Processed in 0.079464 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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