cj4025 发表于 2011-9-6 21:17:35

检查检查进程里[qq.exe]在运行.则关闭进程里[qq.exe]

请教大虾。实现这样这么写?


检查检查进程里在运行.则关闭进程里 如果进程里没有,则运行 ..想得很简单,
If ProcessExists("qq.exe") Then
        ProcessClose("qq.exe")
        $PID = ProcessExists("qq.exe")
        If $PID Then ProcessClose($PID)
        EndIf

cj4025 发表于 2011-9-6 21:19:17

想了半天,脑子没转开。感觉点很绕,

想想,其实就是个循环的问题。可就是不真的这么写。

wsfda 发表于 2011-9-6 22:07:10

呵呵,楼主真逗哦

cxlater 发表于 2011-9-6 22:37:03

这个不难吧

sunafter 发表于 2011-9-7 08:28:15

有可能不止一个QQ.exe哦
其实很容易的,俺懒得写了,哪个好心人帮楼主写一个吧

cxlater 发表于 2011-9-7 19:31:01



If ProcessExists("qq.exe") Then
        Do
                ProcessClose("qq.exe")
        Until Not ProcessExists("qq.exe")
Else
        Run("qq.exe")
EndIf

xiehuahere 发表于 2011-9-7 21:23:16

本帖最后由 xiehuahere 于 2011-9-7 21:35 编辑

我一般习惯于用 ShellExecute 来运行外部程序(非DOS命令)。while ProcessExists("QQ.exe")
      ProcessClose("QQ.exe")
WEnd
ShellExecute(@ProgramFilesDir & '\Tencent\QQ\Bin\QQ.exe')

cxlater 发表于 2011-9-7 21:48:51

ShellExecute 会调用已注册文件类型 来打开或执行文件
个人感觉shellexecute效率不如run

netegg 发表于 2011-9-7 22:49:14

本帖最后由 netegg 于 2011-9-7 22:54 编辑

回复 8# cxlater
shellexecute和run在对文件的处理上是有区别的,可以试试看下建立个文本文件(1.txt),分别用两个命令运行,就能看出来了,当然,对于exe文件来说,差别不大

cj4025 发表于 2011-9-8 21:30:29


cxlater 发表于 2011-9-7 19:31 http://www.autoitx.com/images/common/back.gif

谢谢你了,,你这个方法好用。谢谢你了。

cj4025 发表于 2011-9-8 21:31:40

回复 7# xiehuahere


    谢谢你。你的方法也很好。但是不是我想要的效果。

{:face (332):}

cj4025 发表于 2011-9-8 21:32:31

回复 6# cxlater


    你的方法很好。,谢谢你。我已经采用啦。。


{:face (270):}

netegg 发表于 2011-9-9 09:41:41

$a = processlist('qq.exe')
if isarray($a) then
for $i in $a
   processclose($i)
next
endif

chinafla 发表于 2011-9-9 11:16:26

学习学习 顶

jsgh1983 发表于 2011-9-19 14:11:07

原来可以有这么多得方法呀!看样子得多看帖子多学习,这样才能进步!
页: [1] 2
查看完整版本: 检查检查进程里[qq.exe]在运行.则关闭进程里[qq.exe]