Archive: WM_QUERYENDSESSION and logoff/shutdown


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


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


Done
http://nsis.sourceforge.net/ShutdownAllow_plug-in
Only took a minute or two.

-Stu


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!


Or with this old plug-in:

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