2个回答
展开全部
Option Explicit
Private Sub Command1_Click()
MsgBox ExePath("vb6.exe")
End Sub
Public Function ExePath(ExeNm As String) As String
Dim objWMIService, colProcesslist, objProcess
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colProcesslist = objWMIService.ExecQuery("Select * from Win32_Process Where Name = '" & ExeNm & "'")
If colProcesslist.Count > 0 Then
For Each objProcess In colProcesslist
ExePath = ExePath & objProcess.ExecutablePath & vbCrLf
Next
End If
Set objWMIService = Nothing
Set colProcesslist = Nothing
End Function
追问
谢谢大神呐
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询