无忧启动论坛
标题:
求助,au3脚本写代码时如何调用运行qq.exe的同时最小化运行
[打印本页]
作者:
2011ziyouren
时间:
2013-12-3 20:53
标题:
求助,au3脚本写代码时如何调用运行qq.exe的同时最小化运行
本帖最后由 2011ziyouren 于 2013-12-7 07:40 编辑
au3脚本写代码时如何调用运行qq.exe的同时最小化运行qq.exe,不让看到窗口,关闭脚本同时关闭qq.exe
谢谢!
作者:
xulinghai
时间:
2013-12-3 21:58
不知道这样行不:
#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
复制代码
作者:
2011ziyouren
时间:
2013-12-4 07:47
谢谢大哥!帮了我的帮大忙。
作者:
2011ziyouren
时间:
2013-12-4 08:18
大哥:我要把运行按钮取消直接运行qq.exe,代码怎么改谢谢!
作者:
2011ziyouren
时间:
2013-12-4 22:07
谢谢xulinghai大哥的代码让我学习了很多,我原本是想这样运行。
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("运行QQ", 265, 265, -1, -1)
$Button1 = GUICtrlCreateButton("退出", 80, 96, 105, 65)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Run(@ScriptDir &"\qq.exe","",@SW_MINIMIZE)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $Form1
_Quit()
Case $Button1
_Quit()
Exit
EndSwitch
WEnd
Func _Quit()
If ProcessExists("qq.exe") Then ProcessClose("qq.exe")
GUIDelete($Form1)
Exit
EndFunc ;==>_Quit
欢迎光临 无忧启动论坛 (http://bbs.wuyou.net/)
Powered by Discuz! X3.3