找回密码
 加入
搜索
查看: 4095|回复: 9

[AU3基础] 进程结束工具源码有点问题,求助,已解决

  [复制链接]
发表于 2010-9-19 12:30:43 | 显示全部楼层 |阅读模式
本帖最后由 m765555 于 2010-9-21 15:32 编辑
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("进程结束工具", 301, 101, 192, 124)
GUISetIcon("D:\autoit3\AU3TOOL.exe", -1)
$Label1 = GUICtrlCreateLabel("请输入要结束的进程名", 8, 40, 132, 25)
$Input1 = GUICtrlCreateInput("比如qq.exe", 144, 40, 113, 21)
$Button1 = GUICtrlCreateButton("结束进程", 128, 72, 65, 17)
$Button2 = GUICtrlCreateButton("退出程序", 216, 72, 65, 17)


GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Func lsc()
    $rinput=GUICtrlRead($Input1)
If  $rinput="" Then
                MsgBox(0,"提示","结束进程名不能为空")
                
        Else
                $list1=ProcessList()
                  For $i=1 To $list1[0][0]
                $rr=StringInStr($list1[$i][0],$rinput)
        If $rinput=$rr Then         
        MsgBox(16,"警告","进程存在,马上结束",5)
        ProcessClose($rr) 
    EndIf
        Next
EndIf
                
EndFunc        

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $nMsg=$Button1
                        lsc()
            Case $nMsg=$Button2
                        Exit

EndSwitch
WEnd
我想输入某个进程名,点结束就可以结束某进程,但本人刚学习中,所以技术太难,请高手指点一下,谢谢

评分

参与人数 1金钱 +10 收起 理由
afan + 10 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

发表于 2010-9-19 13:09:12 | 显示全部楼层
ProcessSetPriority($rr,0):设置进程优先级
ProcessClose($rr)
这样试试看
 楼主| 发表于 2010-9-19 13:14:23 | 显示全部楼层
好像还是不行,我先再看看,谢谢兄弟指点
发表于 2010-9-20 05:55:19 | 显示全部楼层
#include <GUIConstantsEx.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("进程结束工具", 301, 101, 192, 124)
GUISetIcon("D:\autoit3\AU3TOOL.exe", -1)
$Label1 = GUICtrlCreateLabel("请输入要结束的进程名", 8, 40, 132, 25)
$Input1 = GUICtrlCreateInput("比如qq.exe", 144, 40, 113, 21)
$Button1 = GUICtrlCreateButton("结束进程", 128, 72, 65, 17)
$Button2 = GUICtrlCreateButton("退出程序", 216, 72, 65, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        $rinput = GUICtrlRead($Input1)
                        If $rinput = "" Then
                                 MsgBox(0,"提示","结束进程名不能为空")
                        Else
                                If ProcessExists($rinput) Then
                                        MsgBox(16,"警告","进程存在,马上结束",5)
                                        ProcessClose($rinput)
                                EndIf
                        EndIf
                Case $Button2
                        Exit

        EndSwitch
WEnd

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

发表于 2010-9-20 13:56:35 | 显示全部楼层
4楼的代码写得很不错,学习了!!
 楼主| 发表于 2010-9-21 08:39:50 | 显示全部楼层
非常感谢四楼!!!!!!
 楼主| 发表于 2010-9-21 09:18:18 | 显示全部楼层
开始的问题已经解决,不过还有个新的问题要了解一下,请高手们再指点一下,学习学习:比如结束360进程,无法结束,但我想它提示为“些进程无法结束”或者用另类方法将其进程真正结束也可以。
我开始的代码为:
#include <GUIConstantsEx.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("明兵进程结束工具", 301, 101, 392, 324)
GUISetIcon("D:\autoit3\AU3TOOL.exe", -1)
$Label1 = GUICtrlCreateLabel("请输入要结束的进程名", 8, 40, 132, 25)
$Input1 = GUICtrlCreateInput("比如QQ", 144, 40, 113, 21)
$Button1 = GUICtrlCreateButton("结束进程", 128, 72, 65, 17)
$Button2 = GUICtrlCreateButton("退出程序", 216, 72, 65, 17)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        $prr=GUICtrlRead($Input1)& ".exe"
                        If $prr="" Then
                                MsgBox(16,"警告","进程名不能为空",2)
                        Else
                                If ProcessExists($prr) Then
                                        MsgBox(0,"提示","进程存在,马上将结束",1)
                                        ProcessClose($prr)
                                ElseIf Not ProcessExists($prr) Then
                                        MsgBox(0,"提示","进程不存在,马上退出",1)
                                EndIf
                        EndIf
            
            Case $Button2
                        Exit

        EndSwitch
WEnd
 楼主| 发表于 2010-9-21 09:20:44 | 显示全部楼层
360进程无法结束,这样的话我想它提示为“该进程无法正常结束”或者用其它方法真正的结束此进程???再次请教!!!
我现在的代码为:
#include <GUIConstantsEx.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("明兵进程结束工具", 301, 101, 392, 324)
GUISetIcon("D:\autoit3\AU3TOOL.exe", -1)
$Label1 = GUICtrlCreateLabel("请输入要结束的进程名", 8, 40, 132, 25)
$Input1 = GUICtrlCreateInput("比如QQ", 144, 40, 113, 21)
$Button1 = GUICtrlCreateButton("结束进程", 128, 72, 65, 17)
$Button2 = GUICtrlCreateButton("退出程序", 216, 72, 65, 17)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        $prr=GUICtrlRead($Input1)& ".exe"
                        If $prr="" Then
                                MsgBox(16,"警告","进程名不能为空",2)
                        Else
                                If ProcessExists($prr) Then
                                        MsgBox(0,"提示","进程存在,马上将结束",1)
                                        ProcessClose($prr)
                                ElseIf Not ProcessExists($prr) Then
                                        MsgBox(0,"提示","进程不存在,马上退出",1)
                                EndIf
                        EndIf
            
            Case $Button2
                        Exit

        EndSwitch
WEnd
发表于 2010-9-21 13:54:09 | 显示全部楼层
4楼,支持4楼
发表于 2010-9-21 13:56:58 | 显示全部楼层
回复 4# lixiaolong


   大哥,有时间帮忙看一下我的问题啊,,地址:http://www.autoitx.com/thread-18562-1-1.html  谢谢!发现这位大哥,很乐意帮助人
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-10-3 06:31 , Processed in 0.099916 second(s), 29 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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