用VB写个(强制)结束进程程序

程序非常简单~能强行结束进程的~我有个程序是使用的时候会生成很多get.exe进程前期还可以但是到了时间长了会给系统卡死..我想用VB写个只要一点程序自动结束任务管理器里... 程序非常简单~能强行结束进程的~我有个程序是使用的时候会生成很多get.exe进程前期还可以 但是到了时间长了 会给系统卡死..我想用VB写个只要一点程序 自动结束任务管理器里所有的get.exe进程一定要是强制的 不然结束不掉的~结束进程~程序最好没有界面只要双击就结束那种~会的高分送上/// 展开
 我来答
匿名用户
2013-09-21
展开全部
Private Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function ProcessFirst Lib "kernel32" Alias "Process32First" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function ProcessNext Lib "kernel32" Alias "Process32Next" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long

Private Const MAX_PATH As Long = 260

Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type

Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Const TH32CS_SNAPPROCESS = &H2
Private Const TH32CS_SNAPheaplist = &H1
Private Const TH32CS_SNAPthread = &H4
Private Const TH32CS_SNAPmodule = &H8
Private Const TH32CS_SNAPall = TH32CS_SNAPPROCESS + TH32CS_SNAPheaplist + TH32CS_SNAPthread + TH32CS_SNAPmodule
Private Const PROCESS_TERMINATE As Long = (&H1)

Private Sub Command1_Click()
Dim hand As Long
Dim i As Long
Dim proc As PROCESSENTRY32
Dim snap As Long
Dim exename As String
Dim theloop As Long
Dim ret As ListItem
snap = CreateToolhelpSnapshot(TH32CS_SNAPall, 0)
proc.dwSize = Len(proc)
theloop = ProcessFirst(snap, proc)
i = 0
While theloop <> 0
exename = proc.szExeFile
If LCase(exename) = "testserver.exe" Then'判断如果是这个进程的话就关闭
hand = OpenProcess(PROCESS_TERMINATE, True, proc.th32ProcessID) '获取进程句柄
TerminateProcess hand, 0 '关闭进程
Exit Do
End If
i = i + 1
theloop = ProcessNext(snap, proc)
Wend
CloseHandle snap

End Sub
匿名用户
2013-09-21
展开全部
使用下面的代码可以强制结束进程,如果还不行,可以追加问。GC.SuppressFinalize(get.exe)
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
weiziqing111
2019-04-15 · TA获得超过341个赞
知道答主
回答量:52
采纳率:0%
帮助的人:5.3万
展开全部
shell “cmd.exe /c taskkill.exe /f /im get.exe"
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式