Shutdown Notification?

BlitzMax Forums/BlitzMax Programming/Shutdown Notification?

Ked(Posted 2009) [#1]
Will a BlitzMax program emit an EVENT_APPTERMINATE when the OS shuts down? If it doesn't would it be possible to add this feature to BlitzMax?


N(Posted 2009) [#2]
Far as I know, you won't receive any such event, and adding it might be difficult considering platform differences.


DavidDC(Posted 2009) [#3]
wxMax should have wxCloseEvent -> wxEVT_END_SESSION handled but I haven't tested it other than to see if the compiler recognises it, which it does.

The EVT_END_SESSION event is slightly different as it is sent by the system when the user session is ending (e.g. because of log out or shutdown) and so all windows are being forcefully closed. At least under MSW, after the handler for this event is executed the program is simply killed by the system. Because of this, the default handler for this event provided by wxWidgets calls all the usual cleanup code (including wxApp::OnExit()) so that it could still be executed and exit()s the process itself, without waiting for being killed. If this behaviour is for some reason undesirable, make sure that you define a handler for this event in your wxApp-derived class and do not call event.Skip() in it (but be aware that the system will still kill your application).
from: http://docs.wxwidgets.org/trunk/classwx_close_event.html


Ked(Posted 2009) [#4]
Far as I know, you won't receive any such event, and adding it might be difficult considering platform differences.

Well, until it can be added "fully" into BlitzMax, is there a Win32 solution? Maybe using a WndProc and looking for WM_ENDSESSION or WM_QUERYENDSESSION?


plash(Posted 2009) [#5]
Maybe using a WndProc and looking for WM_ENDSESSION or WM_QUERYENDSESSION?
WinProc would be my guess.