Solved

How to determine if another application is running

Posted on 1998-07-09
5
139 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
[X]
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
  • 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 2 hours left to enroll

617 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