|
不知道这样行不:
- #include <GUIConstantsEx.au3>
- Opt("MustDeclareVars", 1)
- Opt("GUIOnEventMode", 1)
- Global $Main = GUICreate("运行QQ", 400, 100, -1, -1)
- Global $Btn1 = GUICtrlCreateButton("运行", 120, 40, 72, 24)
- Global $Btn2 = GUICtrlCreateButton("退出", 220, 40, 72, 24)
- GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg")
- GUICtrlSetOnEvent($Btn1, "GUICtrlMsg")
- GUICtrlSetOnEvent($Btn2, "GUICtrlMsg")
- GUISetState(@SW_SHOW)
- While 1
- Sleep(1000)
- WEnd
- Func GUICtrlMsg()
- Switch @GUI_CtrlId
- Case $GUI_EVENT_CLOSE
- _Quit()
- Case $Btn1
- _RunQQ()
- Case $Btn2
- _Quit()
- EndSwitch
- EndFunc ;==>GUICtrlMsg
- Func _RunQQ()
- If FileExists(@ScriptDir & "\qq.exe") Then
- Run(@ScriptDir & "\qq.exe", "", @SW_MINIMIZE)
- Else
- MsgBox(64, "提示", "程序目录未发现qq.exe文件. ")
- EndIf
- EndFunc ;==>_RunQQ
- Func _Quit()
- If ProcessExists("qq.exe") Then ProcessClose("qq.exe")
- GUIDelete($Main)
- Exit
- EndFunc ;==>_Quit
复制代码 |
|