Option Explicit
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 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
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As LongPrivate Type PROCESSENTRY32
    dwSize As Long
    cntUseage As Long
    th32ProcID As Long
    th32DefaultHeapID As Long
    th32ModuleID As Long
    cntThreads As Long
    th32ParentProcessID As Long
    pcPriClassBase As Long
    swFlags As Long
    szExeFile As String
End Type
Private Const TH32CS_SNAPPROCESS = &H2
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Dim Hand1 As Long
Dim Hand2 As Long
Dim Yn As Boolean
Dim pe32 As PROCESSENTRY32
Private Sub Command1_Click()
Hand1 = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
pe32.dwSize = Len(pe32)
If Process32First(Hand1, pe32) <> 0 Then
Do
If Left(LCase(pe32.szExeFile), InStr(pe32.szExeFile, ".") + 3) = "iexplorer.exe" Then
Hand2 = OpenProcess(PROCESS_ALL_ACCESS, True, pe32.th32ProcID)
If Hand2 = False Then
MsgBox "无法开启进程!"
Exit Do
Else
 TerminateProcess Hand2, 0
Exit Do
End If
End If
Loop While (Process32Next(Hand1, pe32) <> 0)
Else
MsgBox "找不到IE"
End If
CloseHandle (Hand1)
End Sub