vb怎么关闭游戏进程比如说seasky.exe

速度啊... 速度啊 展开
 我来答
mosesmoses0651
推荐于2016-04-22 · TA获得超过2718个赞
知道小有建树答主
回答量:824
采纳率:0%
帮助的人:652万
展开全部
方法一:
Dim procname$, rtn&
Private Sub Command1_Click()
procname = "seasky.exe"
strcomputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where Name = '" & procname & "'")
If colProcessList.Count = 0 Then
MsgBox procname & " 没有运行"
Else
For Each objProcess In colProcessList
rtn = MsgBox("您确定要终止 " & procname & " 吗?", vbYesNo, "强制关闭进程")
If rtn = 6 Then objProcess.Terminate
Next
End If
End Sub

另一种方法是shell taskkill
Shell "taskkill /f /im Shell "seasky.exe",0
百度网友e9042513a
2009-11-22 · TA获得超过6984个赞
知道大有可为答主
回答量:2388
采纳率:0%
帮助的人:3512万
展开全部
VB 6.0 终止指定进程

Option Explicit

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 * 1024
End Type

Private Type MODULEENTRY32
dwSize As Long
th32ModuleID As Long
th32ProcessID As Long
GlblcntUsage As Long
ProccntUsage As Long
modBaseAddr As Byte
modBaseSize As Long
hModule As Long
szModule As String * 256
szExePath As String * 1024
End Type

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Const TH32CS_SNAPHEAPLIST = &H1
Private Const TH32CS_SNAPPROCESS = &H2
Private Const TH32CS_SNAPTHREAD = &H4
Private Const TH32CS_SNAPMODULE = &H8
Private Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST Or TH32CS_SNAPPROCESS Or TH32CS_SNAPTHREAD Or TH32CS_SNAPMODULE)
Private Const TH32CS_INHERIT = &H80000000

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 Declare Function Process32Next Lib "kernel32" (ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject 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 TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long

Sub KillExe(EXEName As String)
Dim my As PROCESSENTRY32
Dim hProcessHandle As Long
Dim success As Long
Dim l As Long

l = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
If l Then
my.dwSize = 1060
If (Process32First(l, my)) Then
Do
If UCase$(Right$(Left$(my.szExeFile, InStr(1, my.szExeFile, Chr$(0)) - 1), Len(EXEName))) = UCase$(EXEName) Then
hProcessHandle = OpenProcess(&H1F0FFF, True, my.th32ProcessID)
If hProcessHandle <> 0 Then success = TerminateProcess(hProcessHandle, ByVal 0&)
If success = 1 Then CloseHandle (hProcessHandle)
End If
Loop Until (Process32Next(l, my) < 1)
End If
CloseHandle l
End If

End Sub

Private Sub Command1_Click()
Dim a As String

a = "c:\game\seasky.exe"
KillExe a

End Sub

参考资料: 原创

来自:求助得到的回答
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
sansene
2009-11-21 · TA获得超过185个赞
知道答主
回答量:127
采纳率:40%
帮助的人:47.5万
展开全部
在任务条上点右键,选任务管理器,找到进程,右键-结束
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式