How to determine if another application is running

We need to launch Crystal Reports from the VB application we are creating.  We are launching it using the Shell command and it works fine.  However, we would like to restrict the user to only open one instance of Crystal Reports (at least from opening one instance from within our app).  How do I check to see if a copy of Crystal Reports is already open so I can decide if I have to use AppActivate or Shell?
csmyserAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
DalinConnect With a Mentor Commented:
Use FindWindow API
0
 
csmyserAuthor Commented:
Adjusted points to 100
0
 
DalinCommented:
csmyser:

This is how to use the API. You need to know the caption of CReport.

Regards
Dalin

Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long            


Dim winHwnd As Long

winHwnd = FindWindow(vbNullString, "Crystal Report") ' what ever the title is

If winHwnd <> 0 Then
    ' Another one is running  
Else
    ' Not runing
End If
           

0
 
csmyserAuthor Commented:
Thanks very much!
0
 
leeskelton83Commented:
What if I want to see if any Excel app is open?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.