Old 10th May 2011, 22:10   #1
JohnChen
Member
 
Join Date: Mar 2011
Posts: 80
How to suppress restarting the computer in nsis?

Is there any way not to allow the user to restart the computer during the installation? Thanks.
JohnChen is offline   Reply With Quote
Old 11th May 2011, 02:27   #2
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Shanghai, China
Posts: 207
Using "Reboot" command. Make sure that all files have been insted. You'd better use a message box to ask for rebooting.

Contact me: 137729898@qq.com
jiake is offline   Reply With Quote
Old 11th May 2011, 07:00   #3
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
He wants to prevent rebooting, not reboot himself. JohnChen, it's not possible to prevent someone from rebooting his computer, because that's a hardware thing. You may be able to prevent a windows shutdown, however. Google tells me you need to monitor for the WM_QUERYENDSESSION message and send WM_CANCELMODE when the message is received. But I wouldn't be surprised if you'd need to modify the NSIS source code to do this.

Long story short: Not possible in any simple way, as far as I can see.
MSG is offline   Reply With Quote
Old 11th May 2011, 11:38   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
NSIS already blocks reboots by handling WM_QUERYENDSESSION and returning FALSE.

Stu
Afrow UK is offline   Reply With Quote
Old 11th May 2011, 17:14   #5
JohnChen
Member
 
Join Date: Mar 2011
Posts: 80
Quote:
Originally Posted by Afrow UK View Post
NSIS already blocks reboots by handling WM_QUERYENDSESSION and returning FALSE.

Stu
Thanks for your reply. Can you briefly explain how I can use this message WM_QUERYENDSESSION in NSIS?
JohnChen is offline   Reply With Quote
Old 11th May 2011, 17:25   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
What?

Stu
Afrow UK is offline   Reply With Quote
Old 11th May 2011, 21:47   #7
JohnChen
Member
 
Join Date: Mar 2011
Posts: 80
Quote:
Originally Posted by Afrow UK View Post
What?

Stu
I meant how to use WM_QUERYENDSESSION in NSIS? Thanks.
JohnChen is offline   Reply With Quote
Old 12th May 2011, 10:11   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I know what you meant but what you are asking doesn't actually make sense in the context of my previous response.
Quote:
NSIS already blocks reboots by handling WM_QUERYENDSESSION and returning FALSE.
I'm not sure how I could rephrase this to make more sense. If NSIS already handles WM_QUERYENDSESSION behind the scenes then why do you need to handle it yourself (except to allow reboots by returning TRUE)?

Stu
Afrow UK 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