Solved

How to determine if another application is running

Posted on 1998-07-09
5
134 Views
Last Modified: 2010-05-03
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?
0
Comment
Question by:csmyser
  • 2
  • 2
5 Comments
 

Author Comment

by:csmyser
Comment Utility
Adjusted points to 100
0
 
LVL 9

Accepted Solution

by:
Dalin earned 100 total points
Comment Utility
Use FindWindow API
0
 
LVL 9

Expert Comment

by:Dalin
Comment Utility
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
 

Author Comment

by:csmyser
Comment Utility
Thanks very much!
0
 
LVL 3

Expert Comment

by:leeskelton83
Comment Utility
What if I want to see if any Excel app is open?
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now