Archive: [Help]how to detect a program is running?


[Help]how to detect a program is running?
Hi All,

I have installed my application (named myApp.exe, it is windows Form application),however, when I try to unistall this application. How can I detect if this program is running, normally we will to do this:
when uninstalling, if detecting this application is running, we should force to close it.(At least close the window, don't want users to use anymore). Then we delete this file right away, don't wait till reboot the computer.

So how to detect program running in NSIS,if found,how to force to close it down so that we can delete the files right away!

Please help me out so that i can meet the project deadline.
Thank you very much.

James


A similar recent thread,
http://forums.winamp.com/showthread....hreadid=262969


But it seems that they are using one plugin dll file, when can i download it to test?


Like every nsis plugin at wiki,
http://nsis.sourceforge.net/Developer_Center


Thank you , Red Wine.

One more thing, I can detect the program running, how can I kill it (just force to close the window). Then i can delete the exe and dll files....


I think the idea of the author on the above thread (pop up a custom page or a message box and ask users to terminate the application before uninstall) is the right way to go.
If you anyway wish to kill it, you may do it either by FindWindow and SendMessage or with NsProcess plugin,
http://nsis.sourceforge.net/NsProcess_plugin


http://forums.winamp.com/showthread....hreadid=259546
humm - forget it... (Update)

"Processes::FindProcess" / "Processes::KillProcess" do it same way, or "fct"


Yeah. Thank you guys. I have don't this part.....Cheers.

one more stuip question:
how can i make one function then both install and uninstall can call it.


There you are :)
http://nsis.sourceforge.net/Macro_vs_Function


Red Wine,

you are the rock. Thank you very very much.......

James


Indeed :) I've been in Woodstock...


NsProcess based on the KillProcDLL, so MSDN warning touchs both plug-ins:
The TerminateProcess function is used to unconditionally cause a process to exit. Use it only in extreme circumstances. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used rather than ExitProcess.
If your application has window Find-Close-Terminate would be better.