?
Solved

Instance of another application

Posted on 1998-06-15
3
Medium Priority
?
130 Views
Last Modified: 2010-05-03
I know how to check the instance of the application that is running.
But how can you check the instance of another application that
might be running?  I have tried to use the Windows API call to
FindWindow(...,...) but I may be calling it wrong.  If someone could
point me in the right direction I would appreciate it.

Thanks -- jr
0
Comment
Question by:jrmcg
[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
3 Comments
 
LVL 6

Expert Comment

by:anthonyc
ID: 1463351
FindWindow(0, "WindowCaptionHere")
0
 
LVL 2

Author Comment

by:jrmcg
ID: 1463352
I tried FindWindow(0,"CAPTION") already.  I think
my problem is in the declaration of the function.
Is there anything wrong with this?:::

Declare Function FindWindow Lib "User32" Alias
"FindWindowA" (ByVal lpClassName As String,
ByVal lpCaption As String) As Long

I tried without the alias and it wouldn't compile.
Maybe the return type is wrong?  I know the
Function returns an hWnd but the compiler
did not like that either.

Thanks -- jr
0
 
LVL 2

Accepted Solution

by:
peterwest earned 120 total points
ID: 1463353
Hi there,

The correct declaration for the API call is:

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

The function returns a long value that is the hWnd of the object found - so basically, if it doesn't return 0 then another instance of that window is already running....

Pete

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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 Month11 days, 18 hours left to enroll

752 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