Old 4th May 2018, 18:43   #1
Gluck
Member
 
Join Date: Apr 2018
Posts: 69
Close a service

I 'm trying to portabilize a service.
It hasn't a command "Quit" (stay open till windows close).

But if I shutdown my computer, I cannot run the code after EXECWAIT...

I can have only the focus on this service.
Is there a keyboad shortcut to close the service and execute the final part of my code?
Gluck is offline   Reply With Quote
Old 4th May 2018, 20:55   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,764
What does close service even mean?

You can stop a service and then delete it, there is no such thing as close.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 5th May 2018, 12:54   #3
Gluck
Member
 
Join Date: Apr 2018
Posts: 69
Example:

I have an app, Notepad, that miss the command "Quit".
So, I can start, but I cannot close it.

If I shut down the computer, how can I execute the code after ExecWait to recover registry, appdata etc?

If I swith off the program with ctrl+alt+canc the code is execute? NSIS knows notepad is closing and run the remaining instructions?

THE PROBLEM: How can I execute the remaining code after close my app?
Gluck is offline   Reply With Quote
Old 5th May 2018, 15:08   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,764
First you talk about service and now Notepad, make up your mind.

You can send the WM_CLOSE message to Notepad and it will close unless it has unsaved data. If you don't care about saving data you can just kill the process.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 5th May 2018, 16:17   #5
Gluck
Member
 
Join Date: Apr 2018
Posts: 69
It's a service, I have made notepad as example...
Anyway your idea about alt+f4 could be good.
Kill the process with NSIS? (KillProcess) I don't know how to do to jump to the line...
What is better, KilProc, KillProcDLL or nsProcess?
Are you sure that NSIS see the service in closing with alt+f4?

thanks
Gluck is offline   Reply With Quote
Old 5th May 2018, 19:26   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,764
You can't close a service with a message because services run in a different session.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump