进程结束工具源码有点问题,求助,已解决
本帖最后由 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
$rr=StringInStr($list1[$i],$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
我想输入某个进程名,点结束就可以结束某进程,但本人刚学习中,所以技术太难,请高手指点一下,谢谢 ProcessSetPriority($rr,0):设置进程优先级
ProcessClose($rr)
这样试试看 好像还是不行,我先再看看,谢谢兄弟指点 #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 4楼的代码写得很不错,学习了!! 非常感谢四楼!!!!!! 开始的问题已经解决,不过还有个新的问题要了解一下,请高手们再指点一下,学习学习:比如结束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
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
4楼,支持4楼 回复 4# lixiaolong
大哥,有时间帮忙看一下我的问题啊,,地址:http://www.autoitx.com/thread-18562-1-1.html谢谢!发现这位大哥,很乐意帮助人
页:
[1]