View Full Version : Check if a program is running before you try to un-install it.
15th May 2001, 18:08
What kind of code do I need to check if a program is running before you try to un-install it?
15th May 2001, 20:10
From Documentation (http://genghis.winamp.com/~deadbeef/free/nsis/makensis.htm):
FindWindow close|closeinstant|prompt|goto:label windowclass [messageboxtext]
Checks for a window whose class name is 'windowclass'. If the window is found, the action is based on what 'mode' is set to.
If mode is 'close', this command will attempt to close the window using WM_CLOSE for up to 8 seconds.
If mode is 'closeinstant', this command will send a WM_CLOSE message to the window and continue.
If mode is 'prompt', this command will prompt the user with 'messageboxtext' until the window is closed manually.
If mode is 'goto:label', FindWindow will Goto label.
FindWindowByTitle close|closeinstant|prompt|goto:label windowtitle [messageboxtext]
Acts like FindWindow, only searches for a window based on title instead of class.
Or is it examples you are looking for?
15th May 2001, 20:20
If that is possible...
e.g. I want to check if program.exe is running.
15th May 2001, 20:46
yes, findwindow(bytitle) is what you are looking for
20th May 2001, 10:35
So, does this 'class' stay the same for the particular program? Is it user-definable? How would one find out class a program has?
Forgive me, I know nothing about classes.
20th May 2001, 17:43
it can stay the same, but it mustn't, that depends on the programmer.
it is not user definable
either you know the classname (because it is documented (like the winamp class 'Winamp v1.x')) or you will have to look it up with a proccess tool (WinSight or something).
20th May 2001, 20:45
hi again ;)
after your post i thought to quick 'n dirty write a small tool for looking up a classname, but a search on the web brought up a pretty nice one, so here is the link:
21st May 2001, 07:34
26th May 2001, 13:13
But can somebody give me an example code? I don't quite get it, you know.
I want to check if my program, CYBERsex.exe is running. And if it is running then I want to promt the user to close it or to abort the uninstall.
26th May 2001, 17:29
try it like this:
FindWindow(ByTitle) GoTo:lbl_found windowclass(or_title)
MessageBox MB_YESNO 'Close App?' ID_NO lbl_abort
FindWindow(ByTitle) close windowclass(or_title)
Abort 'Install Canceled'
i hope it helps
26th May 2001, 19:40
I'm not home right now, but I'll try it ASAP (probably tomorrow).
Thanks for your input! :)
27th May 2001, 06:50
This CYBERsex thing sounds interesting...:)...is it just an example?
27th May 2001, 12:33
CYBERsex is real! ;) Juct click the link in my signature an you'll know all about it. :D
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.