Skip to content
⌘ NSIS Forum Archive

How to close a running task (aka process)

8 posts

robdal#

How to close a running task (aka process)

I'd like to be able to close a running process (i.e: this might be my own app that I'm about to update).

Is that possible with NSIS?

bEST REGARDS
Roberto Dalmonte
kichik#
That really depends on the application you are trying to close. Some will close when you send their main window WM_CLOSE such as Winamp 1 and 2 for example:

loop:
  FindWindow $0 "Winamp v1.x"
  IntCmp $0 0 startCopy
  SendMessage $0 ${WM_CLOSE} 0 0
  Sleep 100
  Goto loop 
Services need a special API call (ControlService). You can use the NET command line utility for services.

Other applications might be waiting for a file to close, or for them to finish their task.

The first method usually works, but you'll still have to be a bit more specific to get an absolute answer. If it's your application then you should know best what makes it close. If it's a VB application or any other wizard programming language then the first method should work.
robdal#
This is, I guess, the most simple example of closing a running window. The following script will terminate notepad.

SilentInstall silent
OutFile "CloseNotepad.exe"
Section "MySection"
FindWindow $0 "Notepad"
SendMessage $0 16 0 0
SectionEnd
javajunki#edited
Hello, I'd like to end a process but it doesn't necessarily have a frame and could be running in the background.... I want to kill any running internet explorer processes so that I can install a browser dependant program. seems IE is running in the background in some cases, and I need to end these processes before I can register my dll or I get an error when upgrading the dll.

Is this possible?

Hope someone can help.🙁

thanks in advance 😁
robdal#
Sorry, I don't know how to accomplish that. I tried different things without success.
If I happen to succeed sooner or later I'll let you know
robdal@tiscali.it
virtlink#
KiCHiK posts his email adress in separate parts, and you should do that too to avoid Spambot's to pick up your email adress and send you a mailbox full of spam.
Like this:
robdal at tiscali dot it