Archive: How to suppress restarting the computer in nsis?


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.


Using "Reboot" command. Make sure that all files have been insted. You'd better use a message box to ask for rebooting.


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.


NSIS already blocks reboots by handling WM_QUERYENDSESSION and returning FALSE.

Stu


Originally posted by Afrow UK
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?

What?

Stu


Originally posted by Afrow UK
What?

Stu
I meant how to use WM_QUERYENDSESSION in NSIS? Thanks.

I know what you meant but what you are asking doesn't actually make sense in the context of my previous response.

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