自己写了一个开机启动程序选择程序,我的思路是程序运行后,默认10秒后自动运行所选择的程序,10秒中内我可以点击确定立即执行或点取消退出程序不执行。但我现在倒计时中点击确定或取消根本没反应,我应该如何修改?先谢谢各位大虾了!
[au3]#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
[/au3]
[ 本帖最后由 hpebble 于 2008-5-17 07:56 编辑 ] |