找回密码
 加入
搜索
查看: 3634|回复: 6

[AU3基础] [已解决]:求助,运行QQ的同时怎么关闭《运行程序集》窗口附上源码

  [复制链接]
发表于 2013-12-20 22:24:37 | 显示全部楼层 |阅读模式
本帖最后由 QQ386263723 于 2013-12-21 21:09 编辑

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("运行程序集", 502, 238, 244, 143)
$Button1 = GUICtrlCreateButton("运行QQ", 56, 104, 105, 41)
$Button2 = GUICtrlCreateButton("运行迅雷", 196, 102, 105, 41)
$Button3 = GUICtrlCreateButton("运行酷狗", 336, 104, 105, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        Case $Button1
                        RunWait(@ScriptDir & "\QQ.exe")
        EndSwitch
WEnd

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2013-12-20 23:27:21 | 显示全部楼层
Case $Button1
                        RunWait(@ScriptDir & "\QQ.exe")
改为
        Case $Button1
                        Run(@ScriptDir & "\QQ.exe")
                         Exit
 楼主| 发表于 2013-12-21 08:01:43 | 显示全部楼层
本帖最后由 QQ386263723 于 2013-12-21 08:02 编辑

太感谢afan版主了,我还想冒昧的问一下,退出运行QQ后还能在打开运行程序集的窗口吗?本人刚刚学习au3就被它吸引了,就是互相调用。
发表于 2013-12-21 08:31:34 | 显示全部楼层
本帖最后由 xlj310 于 2013-12-21 08:33 编辑

回复 3# QQ386263723


    你可以用WinSetState("运行程序集","运行QQ",@SW_HIDE)函数设置主程序隐藏,然后再通过判断QQ.exe这个进程是否有变化,将运行程序集设置显示即可。
如果你只有一个QQ,那只需if not ProcessExists("QQ.exe") then WinSetState("运行程序集","运行QQ",@SW_SHOW)即可。

如果你有多个QQ,那就用ProcessList("qq.exe")得到所有QQ进程列表(具体的自己看帮助程序),然后判断QQ进程的变化再显示运行程序集

评分

参与人数 1金钱 +10 收起 理由
yinbinly + 10 很给力

查看全部评分

 楼主| 发表于 2013-12-21 15:29:16 | 显示全部楼层
本帖最后由 QQ386263723 于 2013-12-21 15:31 编辑

Run(@ScriptDir & "\QQ.exe")
                        WinSetState("运行程序集","运行QQ",@SW_HIDE)
这样可以隐藏主程序(如果不要判断QQ.exe这个进程是否有变化,)就是直接退出QQ.exe如何在把主程序显示出来。具体能用代码演示一下吗?谢谢!
还要用这个if not ProcessExists 定义吗?
发表于 2013-12-21 16:33:10 | 显示全部楼层
GUICreate('运行程序集', 502, 238)
$Button1 = GUICtrlCreateButton('运行QQ', 56, 104, 105, 41)
$Button2 = GUICtrlCreateButton('运行迅雷', 196, 102, 105, 41)
$Button3 = GUICtrlCreateButton('运行酷狗', 336, 104, 105, 41)
GUISetState()
Local $Pid, $ExeFlag

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case -3
                        Exit
                Case $Button1
                        $Pid = _RunMyExe(@ScriptDir & '\QQ.exe')
                Case $Button2
                        $Pid = _RunMyExe('Thunder.exe 实际路径')
                Case $Button3
                        $Pid = _RunMyExe('KuGou.exe 实际路径')
        EndSwitch

        If $ExeFlag And Not ProcessExists($Pid) Then
                GUISetState()
                $ExeFlag = 0
        EndIf
WEnd

Func _RunMyExe($Exe)
        Local $Pid = Run($Exe)
        If Not $Pid Then Return MsgBox(48, '', $Exe & ' 运行失败,请确认路径')
        GUISetState(@SW_HIDE)
        $ExeFlag = 1
        Return $Pid
EndFunc   ;==>_RunMyExe
 楼主| 发表于 2013-12-21 21:08:01 | 显示全部楼层
afan版主我太崇拜您了,谢谢您耐心的解答,没有白来,一直支持下去,加油……
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-6 03:10 , Processed in 0.080906 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表