Old 11th August 2006, 00:31   #1
dbarrett
Junior Member
 
Join Date: Jul 2006
Posts: 9
WM_QUERYENDSESSION and logoff/shutdown

I read in the 2.02 release notes [1] that NSIS responds "false" to WM_QUERYENDSESSION, and thus aborts any attempt by the user to shutdown or logoff his computer while the NSIS script is running.

Is there any way to override this behavior, short of patching NSIS itself?

I can see why this is often desirable, but in my case I would prefer the script return "true", and just abort the script in place -- the same as if 'quit' were called. Maybe even call the .onAbort handler (though that's not necessary for my needs).

Basically, NSIS is useful for more than just installers -- it's a great programming language for super-small GUI applications. But this restriction really throws a hitch into long-lived NSIS applications.

Any ideas? Thanks!

-david

[1] http://sourceforge.net/project/showf...ease_id=277274
dbarrett is offline   Reply With Quote
Old 11th August 2006, 10:41   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You need to sub-class the window procedure in a C/C++ plugin and return TRUE instead of FALSE.

I can write a small plugin if you need it.

-Stu
Afrow UK is offline   Reply With Quote
Old 11th August 2006, 11:36   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Done
http://nsis.sourceforge.net/ShutdownAllow_plug-in
Only took a minute or two.

-Stu
Afrow UK is offline   Reply With Quote
Old 15th August 2006, 02:05   #4
dbarrett
Junior Member
 
Join Date: Jul 2006
Posts: 9
Wow, that's great! Thanks. The solution I went with was something similar -- I'm using a DLL via the System plugin and I added SetClassLong( ..., GCL_WNDPROC, ... ) on the dialog DLL on entry. Yours is a much more elegant way ot solving it, however. Thanks again!
dbarrett is offline   Reply With Quote
Old 18th August 2006, 10:17   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Or with this old plug-in:

http://forums.winamp.com/showthread....light=shutdown

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik 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