VB中判断指定名称的进程是否存在,VB中判断指定名称进程是否存在,VB中判断指定进程是否存在,VB中判断名称进程是否存在,VB判断指定进程存在,VB判断指定名称的进程是否存在,VB判断指定的进程是否存在,VB判断指定进程是否存在,VB判断进程是否存在,VB判断进程存在,VB判断进程,VB Ename.name,GetObject("winmgmts:\\.\root\cimv2:win32_process").instances,winmgmts:\\.\root\cimv2:win32_process,GetObject("WinMgmts:"),WMI.InstancesOf("Win32_Process"),CheckApplicationIsRun。

VB中判断指定名称的进程是否存在:

简洁版:
Dim Ename
For Each Ename In GetObject("winmgmts:\\.\root\cimv2:win32_process").instances_ '循环进程
    If LCase(Ename.name) = LCase("CSTRIKE-ONLINE.EXE") Then MsgBox "请先关掉游戏,否则无法开启外挂!", vbInformation, "提示:"
Next

---------------------------------------------------------------------------

啰嗦版:
Function CheckApplicationIsRun(ByVal szExeFileName As String) As Boolean
    On Error GoTo Err
    Dim WMI, Obj, Objs
    CheckApplicationIsRun = False
    Set WMI = GetObject("WinMgmts:")
    Set Objs = WMI.InstancesOf("Win32_Process")
    For Each Obj In Objs
        If InStr(UCase(szExeFileName), UCase(Obj.Description)) <> 0 Then
            CheckApplicationIsRun = True
            If Not Objs Is Nothing Then Set Objs = Nothing
            If Not WMI Is Nothing Then Set WMI = Nothing
            Exit Function
        End If
    Next
    If Not Objs Is Nothing Then Set Objs = Nothing
    If Not WMI Is Nothing Then Set WMI = Nothing
    Exit Function
Err:
    If Not Objs Is Nothing Then Set Objs = Nothing
    If Not WMI Is Nothing Then Set WMI = Nothing
End Function
Private Sub Command1_Click()
    If CheckApplicationIsRun("notepad.exe") = True Then
        MsgBox "已经运行了记事本程序"
    Else
        MsgBox "记事本程序没有运行"
    End If
End Sub