Solved

Instance of another application

Posted on 1998-06-15
3
128 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 30 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

Industry Leaders: 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

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

739 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