Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
#1 | Link |
|
Cyberspace Citizen
Join Date: Nov 2005
Posts: 457
|
How to kill a process in NSIS?
Hi,
I would like to add the "auto-update" feature to my sofware but for that I need to make sure that the running process is killed prior to the updates installation. What would be the line(s) for my to add? Thanks, - Dan |
|
|
|
|
|
#6 | Link | |
|
Software Developer
Join Date: Jun 2005
Location: Germany
Posts: 8,513
|
Quote:
Maybe you did not use it properly or you did not enter the right Window name... |
|
|
|
|
|
|
#8 | Link |
|
Software Developer
Join Date: Jun 2005
Location: Germany
Posts: 8,513
|
Getting a window handle via "FindWindow" and sending a WM_CLOSE message to this window via "SendMessage" are common Windows API calls. So they work everywhere. But I don't how to call those functions with InnoSetup, since I never used it before...
|
|
|
|
|
|
#9 | Link |
|
Cyberspace Citizen
Join Date: Nov 2005
Posts: 457
|
Alright, I got it now:
Code:
const
WM_CLOSE = $0010;
function InitializeSetup: Boolean;
var
Wnd: HWND;
begin
Wnd := FindWindowByWindowName('<window name>');
if Wnd <> 0 then SendMessage(Wnd, WM_CLOSE, 0, 0);
Result := True;
end;
Thanks, - Dan |
|
|
|
|
|
#10 | Link |
|
Registered User
Join Date: Jul 2005
Posts: 1
|
If you still want to use nsis then you can use this: http://nsis.sourceforge.net/Processes_plug-in . Works flawlessly in all the setups I have used it in up to now.
|
|
|
|
|
|
#11 | Link | |
|
Software Developer
Join Date: Jun 2005
Location: Germany
Posts: 8,513
|
Quote:
|
|
|
|
|
|
|
#12 | Link |
|
Cyberspace Citizen
Join Date: Nov 2005
Posts: 457
|
Thanks death2all. I'm trying to use NSIS instead of InnoSetup but the latter is easier to implement to my python script. I know that there is a nspython plugin for NSIS but I use Python 2.4 - the plugin supports 2.2 and 2.3 only
![]() Cheers, - Dan |
|
|
|
|
|
#13 | Link |
|
Software Developer
Join Date: Jun 2005
Location: Germany
Posts: 8,513
|
Unfortunately this plugin has a very bad method to specify the process that is to be killed. The docs say, that you enter the file name without .exe extension. But if I enter "MPUI" it will kill MPUI.exe as well as MPUI.2006-12-03.Full-Package.exe. Thus the installer will kill itself. That's not how I need it to work!
Guess I need to make my own plugin... |
|
|
|
|
|
#14 | Link |
|
Software Developer
Join Date: Jun 2005
Location: Germany
Posts: 8,513
|
Okay, here is my own attempt to make a NSIS plugin for killing processes:
http://mulder.dummwiedeutsch.de/pub/...2006-12-14.zip Very simple to use: Code:
Section StrCpy $0 "foo.exe" DetailPrint "Killing all processed called '$0'" KillProc::KillProcess DetailPrint "Killed $0 processes" SectionEnd |
|
|
|
|
|
#15 | Link |
|
Software Developer
Join Date: Jun 2005
Location: Germany
Posts: 8,513
|
Here is an updated version:
http://mulder.dummwiedeutsch.de/pub/...2006-12-16.zip It is now possible to search for processes without killing them.
__________________
"Under that mask he must be crying..." My software projects | My system specifications | My favorite web-browser Last edited by LoRd_MuldeR; 16th December 2006 at 11:30. |
|
|
|
|
|
#17 | Link |
|
Software Developer
Join Date: Jun 2005
Location: Germany
Posts: 8,513
|
1. Removed some unneeded references -> DLL size is now 1/2 of previous version
2. Added some (very brief) documentation http://mulder.dummwiedeutsch.de/pub/...2006-12-16.zip |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|