Archive: HowTo? Detect if app is already running


HowTo? Detect if app is already running
I'd like to detect if the user is already running the application I'm trying to install/upgrade. I can think of several indirect ways to accomplish this ... such is IfFileExists ... but I'd like to do this directly.

This applies to an upgrade, and the user has inadvertently left the application running while doing the install. I'd like to alert him/her to this and instruct them to shut down the app and go thru the install procedure again (or maybe put this in a loop and not proceed until my nsis script detects the application is closed)

Is this something IsWindow is meant for? I didn't understand the IsWindow documentation ... what is HWND in this situation? And I didn't see any examples in the sample scripts.

Can this be done? Is so, how?

TIA


Use the FindWindow function.

Good luck,
greetz, Hendri.


This certainly looks promising ... but is there an example of how to use it? I didn't find anything that accompanied nsis-1.96. Is that something you could help me with? I've gotten pretty spoiled by how much support is on this forum ... but the parameters for getting FindWindow to work don't look particularly obvious.

I've used VisualTest, which has something that might be similar ...
RecVerifyExistence("InVerse Setup: Installation Directory", "#32770", V_WINDOW, TRUE)

Is #32770 the "window class"? Is there some kind of symbolic equivalent? Can I use FindWindow with the contents of the title bar without knowing its window class?

TIA,


Originally posted by paraclete
This certainly looks promising ... but is there an example of how to use it? I didn't find anything that accompanied nsis-1.96. Is that something you could help me with? I've gotten pretty spoiled by how much support is on this forum ... but the parameters for getting FindWindow to work don't look particularly obvious.

I've used VisualTest, which has something that might be similar ...
RecVerifyExistence("InVerse Setup: Installation Directory", "#32770", V_WINDOW, TRUE)

Is #32770 the "window class"? Is there some kind of symbolic equivalent? Can I use FindWindow with the contents of the title bar without knowing its window class?

TIA,
Well you can either search by the windowsclass or the title of the window. I'm guessing that you don't know the windows class, so you can search by title. You can also search for both, but it depends on the type of application.

Hope that helps.