Dim uProcess As PROCESSENTRY32 Dim mSnapShot As Long Dim mName As String‘要关闭的进程名称 Dim mSY As Long Dim i As Integer Dim mProcID As Long Dim mresult DoEvents uProcess.dwSize = Len(uProcess) mSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0&) If mSnapShot Then mresult = ProcessFirst(mSnapShot, uProcess)'获取进程名称 Do While mresult’遍历进程 i = InStr(1, uProcess.szexeFile, Chr(0)) mName = LCase$(Left$(uProcess.szexeFile, i - 1)) If InStr(1, LCase(pro), mName) <> 0 Then mProcID = OpenProcess(1&, -1&, uProcess.th32ProcessID) TerminateProcess mProcID, 0& Exit Sub End If mresult = ProcessNext(mSnapShot, uProcess) Loop End If
Dim mSnapShot As Long
Dim mName As String‘要关闭的进程名称
Dim mSY As Long
Dim i As Integer
Dim mProcID As Long
Dim mresult
DoEvents
uProcess.dwSize = Len(uProcess)
mSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0&)
If mSnapShot Then
mresult = ProcessFirst(mSnapShot, uProcess)'获取进程名称
Do While mresult’遍历进程
i = InStr(1, uProcess.szexeFile, Chr(0))
mName = LCase$(Left$(uProcess.szexeFile, i - 1))
If InStr(1, LCase(pro), mName) <> 0 Then
mProcID = OpenProcess(1&, -1&, uProcess.th32ProcessID)
TerminateProcess mProcID, 0&
Exit Sub
End If
mresult = ProcessNext(mSnapShot, uProcess)
Loop
End If