Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to determine if another application is running

Posted on 1998-07-09
5
136 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
ID: 1465354
Adjusted points to 100
0
 
LVL 9

Accepted Solution

by:
Dalin earned 100 total points
ID: 1465355
Use FindWindow API
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1465356
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
ID: 1465357
Thanks very much!
0
 
LVL 3

Expert Comment

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

837 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