AU3 倒计时安装软件,时间到了自动安装,可以直接点确定和取消
发布网友
发布时间:2023-01-18 00:14
我来回答
共1个回答
热心网友
时间:2023-11-20 12:40
下面是一个示例,应该能满足你的要求:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <Misc.au3>
_Singleton("倒计时Demo")
Local Const $MaxTime = 5 ;倒计时5秒
Local $count = $MaxTime
#Region ### START Koda GUI section ### Form=C:\Users\19004358\Desktop\Form1.kxf
$Form1 = GUICreate("您要安装此软件吗?", 292, 96, 192, 124)
$Label1 = GUICtrlCreateLabel("秒后将自动安装", 120, 16, 88, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$sTimer = GUICtrlCreateLabel($MaxTime, 105, 17, 10, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000ff)
$btnOk = GUICtrlCreateButton("确定", 48, 56, 81, 25)
$btnCancel = GUICtrlCreateButton("取消", 176, 56, 73, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AdlibRegister("UpdateTimer", 1000)
While 1
If $count = 0 Then ExitLoop
$nMsg = GUIGetMsg()
Switch $nMsg
Case $btnOk
ExitLoop
Case $btnCancel, $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
AdlibUnRegister("UpdateTimer")
GUIDelete($Form1)
AutoInstall()
#region 以下为函数定义部分
Func UpdateTimer()
$count -= 1
GUICtrlSetData($sTimer, $count)
EndFunc
;自动安装函数,这里只是个用于演示的例子
Func AutoInstall()
MsgBox(262144, "哈哈", "自动安装已经在运行啦!", 3)
EndFunc
#endregion
热心网友
时间:2023-11-20 12:40
下面是一个示例,应该能满足你的要求:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <Misc.au3>
_Singleton("倒计时Demo")
Local Const $MaxTime = 5 ;倒计时5秒
Local $count = $MaxTime
#Region ### START Koda GUI section ### Form=C:\Users\19004358\Desktop\Form1.kxf
$Form1 = GUICreate("您要安装此软件吗?", 292, 96, 192, 124)
$Label1 = GUICtrlCreateLabel("秒后将自动安装", 120, 16, 88, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$sTimer = GUICtrlCreateLabel($MaxTime, 105, 17, 10, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000ff)
$btnOk = GUICtrlCreateButton("确定", 48, 56, 81, 25)
$btnCancel = GUICtrlCreateButton("取消", 176, 56, 73, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AdlibRegister("UpdateTimer", 1000)
While 1
If $count = 0 Then ExitLoop
$nMsg = GUIGetMsg()
Switch $nMsg
Case $btnOk
ExitLoop
Case $btnCancel, $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
AdlibUnRegister("UpdateTimer")
GUIDelete($Form1)
AutoInstall()
#region 以下为函数定义部分
Func UpdateTimer()
$count -= 1
GUICtrlSetData($sTimer, $count)
EndFunc
;自动安装函数,这里只是个用于演示的例子
Func AutoInstall()
MsgBox(262144, "哈哈", "自动安装已经在运行啦!", 3)
EndFunc
#endregion