Solved

How do I check if another app is running in VB5

Posted on 1998-06-03
5
140 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
Comment Utility
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
Comment Utility
DamienLWW,
Using the FindWindow API function.
I will post the code if you need it
Regards
0
 
LVL 9

Expert Comment

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

772 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