Find out if application is running

G

GeorgeMar

I have an Access application that runs a VB application called "SISComm.exe".
I want to prevent users from running the VB appliction if it is already
running.

I am using FindWindow API from the Microsoft explanation in Knowledge Base.

I have lpWindowName set as a const="SISComm"

I keep getting 0 even when the application is open.

Microsoft lists the Class Name and Application Name for its Windows
applications, what is the lpClassName or lpWindowName for my application?

Many thanks
george
 
G

GeorgeMar

Thank you Doug

It is working fine now in my Access apps.

However, when I try the same thing in my VB apps, I get the
Compile error: Constants,fixed-lengths strings, arrays, user-defined types
and Declare statements not allowed as Public members of object modules.

I created a new class module and put the Declare FindWindow after Option
Explicit as I have done in Access.

Any suggestions
george
 
D

Douglas J. Steele

Odd. I don't see anything public in that code (other than the fEnumWindows
function).

Do you have to use a class module, or can you use a regular module instead?

Otherwise, you're probably better off asking in one of the VB groups. (I
don't have VB installed on this machine, so I can't test anything for you)
 
G

GeorgeMar

Thank you Doug

I moved everything into a module and it works fine.

regards
george
 
Top