App exit seamlessly when system powered off

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
deepti
Experienced Solver
Experienced Solver
Posts: 95
Joined: Tue Jul 17, 2018 5:38 pm

App exit seamlessly when system powered off

Post by deepti » Tue Aug 06, 2019 12:38 pm

Hi All,

We have a wxWidgets based application. When user clicks "Exit" on the app, it exits smoothly without any crash.
However, when the PC is shutdown while the app is running, the app crashes.
Is there any event sent when the PC is shutdown, which can be caught by our application and then exit smoothly?

Please help!

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3353
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: App exit seamlessly when system powered off

Post by ONEEYEMAN » Tue Aug 06, 2019 2:26 pm

Hi,
Look here.

Thank you.

User avatar
doublemax
Moderator
Moderator
Posts: 13879
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: App exit seamlessly when system powered off

Post by doublemax » Tue Aug 06, 2019 3:56 pm

A wxPowerEvent is only sent with regards to system suspending / hibernating.

For power down events you also need to check EVT_QUERY_END_SESSION/EVT_END_SESSION:
https://docs.wxwidgets.org/trunk/classw ... event.html
Use the source, Luke!

Post Reply