Solved

How do I check if another app is running in VB5

Posted on 1998-06-03
5
141 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

863 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

22 Experts available now in Live!

Get 1:1 Help Now