Hi all,
I have faced with problem (OS Windows 7) - I need to separate reaction on wxEVT_CLOSE_WINDOW event in context shutdown/restart OS from one side and close button ("X" button in window header) click from another side. Both of these reactions work through wxWindowBase::Close(bool force) method, so I don't understand how I can separate them.
Thank to all who could push me in right direction.
Defining source of wxEVT_CLOSE_WINDOW event Topic is solved
Re: Defining source of wxEVT_CLOSE_WINDOW event
Use the wxEVT_QUERY_END_SESSION and wxEVT_END_SESSION events. You need to catch them at wxApp level.
http://docs.wxwidgets.org/stable/wx_wxc ... closeevent
The events are directly related to the MSW WM_QUERYENDSESSION and WM_ENDSESSION messages.
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
http://docs.wxwidgets.org/stable/wx_wxc ... closeevent
The events are directly related to the MSW WM_QUERYENDSESSION and WM_ENDSESSION messages.
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Use the source, Luke!
Re: Defining source of wxEVT_CLOSE_WINDOW event
Also, during shutdown the close event cannot be vetoed for sure, if the close comes from the 'x' button or a button calling Close() then it can be vetoed. Check with CanVeto().
Re: Defining source of wxEVT_CLOSE_WINDOW event
Thanks a lot doublemax, your advise realy helped me to resolve problem.