==Msgbox可以显示倒计时吗?==在线等!
本帖最后由 871224 于 2009-11-30 15:15 编辑==Msgbox可以显示倒计时吗?==在线等!
问题:
$result = MsgBox(4,"提示:无操作10秒后默认确定","请选择按钮",10)
Msgbox 设置10秒后不点击“确定按钮”,之后会自动执行“确定按钮”
可以再Msgbox上显示一个倒计时吗?可以具体看到 离自动执行“确定按钮”的时间。
哪位大大帮小弟解答下,谢谢了!! 好像不行吧!我以前这样做过~~但不是正解
MsgBox(4,"提示:无操作10秒后默认确定","请选择按钮",0)
MsgBox(4,"提示:无操作9秒后默认确定","请选择按钮",0)
……
MsgBox(4,"提示:无操作0秒后默认确定","请选择按钮",0)
连续10个Msbox有点烦吧。。。。呵呵 不可以,但可以画个像点的gui,麻烦学会搜索。。。 pcbar大哥的源码,自己改改,就达到要求了#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $time = 30
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("您真的要这么做吗?", 350, 172, 193, 125)
$Label1 = GUICtrlCreateLabel("30秒后将这么做!", 56, 32, 232, 28)
GUICtrlSetFont(-1, 18, 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 ###
AdlibEnable("_timer", 1000)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $Button2
Exit
Case $Button1
ExitLoop
EndSwitch
If $time <= 0 Then ExitLoop
WEnd
main()
Exit
Func _timer()
$time -= 1
GUICtrlSetData($Label1, $time & "秒后将进入!")
GUICtrlSetData($Progress1, (30 - $time) / 0.3)
If $time <= 0 Then AdlibDisable()
EndFunc ;==>_timer
Func main()
MsgBox(0, 'test', '倒计时结束,进入主程序.', 10)
;以下为主程序
Run("地址")
EndFunc ;==>main 额 谢谢呀我研究研究:face (29): 传说中的传送门:http://www.autoitx.com/forum.php?mod=viewthread&tid=1826&highlight=%B5%B9%BC%C6%CA%B1 看看对我也有用啊 看看对我也有用啊 楼主说的是Msgbox
我想除了不停的弹msgbox应该没别办法,减少代码试下循环
kn007 和水木子所说的是用的GUI窗口
在做倒计时这类还是弄成GUI美观些!楼上几位也给到有代码俺就不发了! 搜来的,对你也许有帮助
http://www.autoitx.com/forum.php?mod=viewthread&tid=643#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;----创建启动界面----------------------------------------
$hwnd = GUICreate("启动程序选择", 363, 152, 298, 298)
GUISetBkColor(0xFFFFFF)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040010);explode
$Pic1 = GUICtrlCreatePic("D:\My Documents\My Pictures\炎黄在线MSN03.bmp", 0, 0, 150, 150)
$ButOK = GUICtrlCreateButton(" ", 168, 122, 75, 25, 0)
$ButCancel = GUICtrlCreateButton("取消", 272, 122, 75, 25, 0)
$CkWinkey = GUICtrlCreateCheckbox("启动WinKey", 155, 94, 205, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$CkDesktop = GUICtrlCreateCheckbox("启动DesktopSprite 雪狐桌面精灵", 155, 73, 205, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$CkEyeGuard = GUICtrlCreateCheckbox("启动EyeGuard 眼睛卫士", 155, 52, 205, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$CkUUCall = GUICtrlCreateCheckbox("启动UUCall 网络电话", 155, 30, 205, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$CkiResearch = GUICtrlCreateCheckbox("启动iResearchiClick艾瑞调研通", 155, 9, 205, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
t_time()
;----完成启动界面----------------------------------------
;----选取----------------------------------
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg= $ButOK
check()
Case $msg= $ButCancel
Exit
EndSelect
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
;---------------------------------
;----查选择启动项-------------------------
func check()
$ch1 = GUICtrlRead($CkWinkey)
$ch2 = GUICtrlRead($CkDesktop)
$ch3 = GUICtrlRead($CkEyeGuard)
$ch4 = GUICtrlRead($CkUUCall)
$ch5 = GUICtrlRead($CkiResearch)
If $ch1 = $GUI_UNCHECKED AND $ch2 = $GUI_UNCHECKED AND $ch3 = $GUI_UNCHECKED AND $ch4 = $GUI_UNCHECKED AND $ch5 = $GUI_UNCHECKED then
MsgBox(4096, "注意", "您没有选择任何启动项!",2)
Else
If $ch1 = $GUI_CHECKED Then Run("C:\Program Files\WinKey\WinKey.exe")
If $ch2 = $GUI_CHECKED Then Run("D:\GreenSoft\DesktopSprite2\DesktopSprite.exe")
If $ch3 = $GUI_CHECKED Then Run("D:\GreenSoft\EyeGuard\EyeGuard.exe")
If $ch4 = $GUI_CHECKED Then Run("D:\GreenSoft\UUCall网络电话3.exe")
If $ch5 = $GUI_CHECKED Then Run("D:\GreenSoft\iClick\iResearchiClick.exe")
Exit
EndIf
endfunc
;---------------------------------
Func t_time()
Dim $begin = TimerInit(),$dif=0
While $dif<10
$dif = Int(TimerDiff($begin)/1000)
GUICtrlSetData($ButOK,"确定("& 10-$dif & "秒)")
GUISetState()
Sleep(100)
WEnd
EndFunc 倒计时正常用的是GUI方式,如果一定要用那个MSGBOX来完成的话,就需要TIMER(或者说是用CoProc.au3来帮助完成了) :face (8):这么多方法 看样我不该来 本帖最后由 lpxx 于 2009-11-26 17:40 编辑
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
$started = 1
$mainwindow = GUICreate("", 210, 100)
GUICtrlCreateLabel("", 35, 15)
$btnExit = GUICtrlCreateButton("OK", 70, 50, 65)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Terminate")
GUICtrlSetOnEvent($btnExit, "_Terminate")
GUISetState(@SW_SHOW)
While 1
for $i = 6 to 1 Step -1
GUICtrlSetData($btnExit," (" & $i & ")")
sleep(1000)
Next
If $started Then
GUIDelete($mainwindow)
EndIf
Exit
WEnd
Func _Terminate()
$started = 0
Exit
EndFunc ;==>_Terminate 就MsgBox这个函数本身来说,没有更多的功能选择,除非下一版本对其进行“破坏性修改”,或添加另一个函数。