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

程序非常简单~能强行结束进程的~我有个程序是使用的时候会生成很多get.exe进程前期还可以 但是到了时间长了 会给系统卡死..我想用VB写个只要一点程序 自动结束任务管理器里所有的get.exe进程一定要是强制的 不然结束不掉的~结束进程~程序最好没有界面只要双击就结束那种~会的高分送上///

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
温馨提示:内容为网友见解,仅供参考
第1个回答  2013-09-21
使用下面的代码可以强制结束进程,如果还不行,可以追加问。GC.SuppressFinalize(get.exe)
第2个回答  2019-04-15
shell “cmd.exe /c taskkill.exe /f /im get.exe"

用VB写个(强制)结束进程程序
回答:使用下面的代码可以强制结束进程,如果还不行,可以追加问。GC.SuppressFinalize(get.exe)

用VB脚本强行关闭进程如何实现?
killname="ascii.exe|a.exe|b.exe" '要kill的进程名字,用"|"分割开 kill=Split(killname,"|")While True for i=1 to 60 '每分钟kill一次,60就是60秒的意思 wscript.sleep 1000 next call kl Wend Private Sub kl()for each ps in getobject("winmgmts:\\\\.\\root\\cimv2:win32_process"...

vb 强力结束几个指定进程
用VB结束进程,下面以Word为例。Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long Private Declare Function Process32First Lib "kernel32" (ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long Private D...

VB结束进程
rtn = MsgBox("您确定要终止 " & procname & " 吗?", vbYesNo, "强制关闭进程")If rtn = 6 Then objProcess.Terminate Next End If End Sub

在VB程序结束之前,关闭某进程
'结束进程 Dim lProcess As Long Dim lExitCode As Long lProcess = OpenProcess(1, False, tPE.th32ProcessID)TerminateProcess lProcess, lExitCode CloseHandle lProcess End If '进程指针下移一位,搜索下一个进程 lNextProcess = Process32Next(lSnapShot, tPE)Loop '释放进程句柄 CloseHandle ...

帮忙写一下 vb 强制 结束进程 源代码!!!
findwindow postmessage API声明 const wm_close=&H10 dim handle as long private sun time1_timer dim a as string a="360tray.exe"handle=findwindow(vbnullstring,a)if handle<>0 then postmessage handle,wm_close,0,0 end if end sub 没测试过,自己手打的 ...

怎么用VB写关闭进程的程序,比如QQ和一些游戏,要求开机自动启动的,儿 ...
,然后把qq.exe改成相应的进程就行了。第二种方法:用组策略禁用程序 开始→运行→输入gpedit.msc→用户配置→管理模板→系统,在右边找到“不要运行制定的windows应用程序”在里面添加你不要运行的程序。不知道怎么弄的追问。第三种方法,用VB整个小程序出来禁止,这个今天没时间搞了,明天再说吧。

如何用VB做强制关闭其他程序??
Private Const TH32CS_SNAPmodule = &H8 Private Const TH32CS_SNAPall = TH32CS_SNAPPROCESS + TH32CS_SNAPheaplist + TH32CS_SNAPthread + TH32CS_SNAPmodule Private Const MAX_PATH As Integer = 260 Private Const PROCESS_ALL_ACCESS = &H1F0FFF Private Const PROCESS_CREATE_PROCESS = &H80 Pri...

如何用VB编写定时强制关闭进程
Private Sub Command1_Click()Call KillQQ End Sub Private Sub Command2_Click()Call EditReg End Sub Private Sub Form_Load()Command1.Move 800, 700, 3000, 500 Command1.Caption = "15分钟后强制关闭QQ"Command2.Move 800, 1400, 3000, 500 Command2.Caption = "添加注册表项"End Sub ...

问一下,vb中如何强制结束一个进程,谢谢大神了!
DELAY_UNTIL_REBOOT=&H4PrivateConstMOVEFILE_REPLACE_EXISTING=&H1'api声明MoveFileExTextpath.Text,vbNullString,MOVEFILE_DELAY_UNTIL_REBOOT'把原来文件kill这个函数可以重启删除文件,在这里就是删除textpath.text中所写的文件,很多工具不是可以重启删除文件吗?就是利用这个函数的 ...

相似回答