• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

Check if another application is running - URGENT

Hi Experts,

This is probably really easy but i am trying to see if an application is already running, if not then i would want to launch it from my application, Any ideas?

Thanks,

Munzi
0
munzi79
Asked:
munzi79
1 Solution
 
ShauliCommented:
Public Sub ProcessExist(ByVal sbFilename As String)
    Dim Process As Variant, tmpProcess As String
    tmpProcess = Mid$(sbFilename, InStrRev(sbFilename, "\", -1) + 1)
    For Each Process In GetObject("winmgmts:").ExecQuery("select * from Win32_Process")
        If LCase(Process.Name) = LCase(tmpProcess) Then
            MsgBox tmpProcess & " already runs"
            Exit Sub
        End If
    Next
    Shell sbFilename
End Sub

Private Sub Command1_Click()
    Call ProcessExist("c:\Path&filename.exe")  '<<< modify
End Sub

S
0
 
munzi79Author Commented:
Thanks Dhaest ,

That works for findind if an application is running but how do i launch another program, can you help?

munzi
0
 
jimbobmcgeeCommented:
Simplest way is

    Shell "x:\pathto\program.exe"

J.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now