VB中判断指定名称的进程是否存在,VB中判断指定名称进程是否存在,VB中判断指定进程是否存在,VB中判断名称进程是否存在,VB判断指定进程存在,VB判断指定名称的进程是否存在,VB判断指定的进程是否存在,VB判断指定进程是否存在,VB判断进程是否存在,VB判断进程存在,VB判断进程,VB Ename.name,GetObject("winmgmts:.rootcimv2:win32_process").instances,winmgmts:.rootcimv2:win32_process,GetObject("WinMgmts:"),WMI.InstancesOf("Win32_Process"),CheckApplicationIsRun。
VB中判断指定名称的进程是否存在:
简洁版:
Dim Ename
For Each Ename In GetObject("winmgmts:.rootcimv2: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
|
文章来源于lcx.cc:【VB技巧】VB中判断指定名称的进程是否存在
相关推荐: 只用一条DOS,CMD命令判断,搜索,查找局域网,互联网中存活的主机
站长补充: 哈哈哈,文章发出后,又有人留言给了个更给力的命令: for /l %p in (1,1,254) do @ping 192.168.1.%p -n 1 -w 10 |find /i "TTL" 还可以判断互联网哟,速度刚刚的,Soga …… 上周a…
评论