码迷,mamicode.com
首页 > 其他好文 > 详细

VB判断EXE文件是否打开。

时间:2021-03-09 13:17:05      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:count   rgb   进程   where   nothing   val   ros   user   div   

试了好多种,这个方法蛮好用的。有更好的,希望大家多多指教。




Dim ProNo As Integer, ProStr As String ProNo = IsRunning("SSS.exe") If ProNo = 0 Then Shell App.path & "\SSS.exe ‘" & strusername & "‘, PDAOvenInBatch", vbNormalFocus ‘" & strusername & "‘, PDAOvenInBatch End If 方法 Function IsRunning(ByVal process As String) As Integer Dim OBJWMIService, colProcesses, colProcesse As Object Set OBJWMIService = GetObject("winmgmts:") Set colProcesses = OBJWMIService.ExecQuery("Select * From Win32_Process Where Name=‘" & process & "") IsRunning = colProcesses.count For Each colProcesse In colProcesses MsgBox colProcesse.ExecutablePath ‘ 进程路径Next Set colProcesses = Nothing: Set OBJWMIService = Nothing End Function

 

VB判断EXE文件是否打开。

标签:count   rgb   进程   where   nothing   val   ros   user   div   

原文地址:https://www.cnblogs.com/Mandy-ZQ-Ma/p/14499874.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!