To find whether the program has been running three methods:
1.
If Ubound (Diagnostics. Process. GetProcessesByName (Diagnostics. Process. GetCurrentProcess. ProsseName)) & gt; 0 then
Messagebox. Show (" the program is running!" )
End the if
2.
Dim ps As new Process
For Each ps In Diagnostics. Process. GetProcesses
If pro. ProcessName="process name" Then
Messagebox. Show (" the program is running!" )
End the If
Next
3.
'write a function,
As a Boolean Function FindProcess (ProcessName)
Dim ps
'the enumeration process
For Each ps In GetObject (" winmgmts: \ \. \ root \ cimv2: win32_process "). The instances_ 'circulation process
If UCase (ps. Name)=UCase (ProcessName) Then
FindProcess=True
The Exit Function
End the If
Next
End the Function
,
=the following call processIf FindProcess (" XXXX. Exe ") Then 'in this modification for the program you are looking for
MsgBox. Show (" the program is running!" )
The Else
MsgBox. Show (" this program is not running!" )
End If