Archive: How to check if a program is already running?


How to check if a program is already running?
Hi,

I've checked everywhere and am surprised not to be able to find the answer to what must be a common problem.

I am installing a program, and want to check if the program is already running. If it is, obviously I won't be able to update it with a new version, so I want to pop open a window telling them to exit it first.

I could set overwrite mode to "try" and use "IfErrors" afterwards, but the copy might have failed for some other reason (need admin permissions, for example).

I looked at FindWindow, but the title changes, and the class seems to change too.

If only "File" did more than just set an error flag. I need to know what the error was. If it was a file-in-use error, then the program is probably already running. If it is a permission thing, then they probably need to log on as Administrator.

Any ideas out there?
Thanks,
Rob.


Use the FindProc plugin.
You can download it from here.


Iceman_K,

I am looking at the description of the plugin, and I have a question for you: If $R0 = '1', then were can I find the window handle in order to send it a WM_CLOSE message? Thanks!

BR,
Dave


If you simply want to kill the process, use the KillProc plugin. If you want it to gracefully shutdown, use the FindWindow instruction to get the window handle before sending the WM_CLOSE message.