Skip to content
⌘ NSIS Forum Archive

Detecting application when run by another user. FindWindow or...?

3 posts

juliarg#

Detecting application when run by another user. FindWindow or...?

In my uninstaller, I want to handle correctly the situation when one user on the machine tries to uninstall the app when another user has it running. Normally, I identify the running application using FindWindow and then looking at the window's user data from GetWindowLong(). But in this case, it doesn't seem to work. Can FindWindow find another user's windows? Is there a better way to handle this task?
jpderuiter#
FindWindow will not work:
Originally Posted by http://support.microsoft.com/kb/310153/en-us
The traditional approach of using FindWindow or FindWindowEx will not work on a Windows XP system on which fast user switching is enabled because it will not detect application instances that are running in different user sessions (on different desktops).
The suggested method on this site using a Global Mutex requires you to edit the application you want to install...
If that's possible, you can use:

to check if it's running already.

Else you may try to use the method of trying to open the application executable for writing.
If it fails, it's in use:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.

Not sure if this works with fast user switching.
Wizou#
See http://nsis.sourceforge.net/Check_wh...ion_is_running

maybe one of the answers suits your situation