Solved

How do I check if another app is running in VB5

Posted on 1998-06-03
5
142 Views
Last Modified: 2010-05-03
I need to find out if and how VB5 can check to see if another application is running.  For example, I want to fire off a Powerpoint Slide in the Powerpoint Viewer (PPVIEW32.EXE) and I need VB5 to check and see if it is still running.  How do I do this?
0
Comment
Question by:DamienLWW
  • 3
5 Comments
 
LVL 1

Expert Comment

by:sirigere
ID: 1462393
I think windows API function Enuwindows can be used to check out wheathet that particular application is runing or not.
0
 
LVL 9

Accepted Solution

by:
Dalin earned 70 total points
ID: 1462394
DamienLWW,
Using the FindWindow API function.
I will post the code if you need it
Regards
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1462395
DamienLWW
If you have any questions, let me know
Regards

Add this to the General Declaration area:

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


Add this to where you want to check your power points app.

Dim myHandle as Long
myHandle = FindWindow(0&, "Microsoft PowerPoint")
If gTCWHandle = 0 Then
     
 ' App not Running

Else
' App is running

End If
0
 
LVL 1

Expert Comment

by:Sekans
ID: 1462396
Dalin, might I suggest using vbNullString to pass the null terminated string.  Also, I believe your code should be:
if myHandle = ...

not if gTCWHandle = ...

Respectfully,
Sekans
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1462397
Sekans,
Thank you for the comments.
I just copied the code from my project which look for a window called TCW.
Sorry for any confusion it may have caused.
Regards
Dalin
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…

816 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