checking things before application shutdown

I'm trying to figure out what I need to do to check for 1) unsaved data and 2) open database connections when my application is shut down. It seems like I just need to catch the EVT_CLOSE event and do the work there, but after reading p.39 of the book, I'm a little confused. It mentions using EVT_QUERY_END_SESSION. Is this used for when *outside* factors attempt to close the application? Will the cleanup in the EVT_CLOSE handler still run, or do I need to specify this other event as well?

Also, is it always necessary to do the Veto check before shutting down, or is that done just when outside factors try to shut it down?

Thanks.

I'm trying to figure out what I need to do to check for 1) unsaved data
and 2) open database connections when my application is shut down. It
seems like I just need to catch the EVT_CLOSE event and do the work
there, but after reading p.39 of the book, I'm a little confused. It
mentions using EVT_QUERY_END_SESSION. Is this used for when *outside*
factors attempt to close the application? Will the cleanup in the
EVT_CLOSE handler still run, or do I need to specify this other event as
well?

From what I understand, EVT_QUERY_END_SESSION will only be seen if your
application is running when your computer is shut down, restarted, or
logged off. I haven't tested it, but I don't believe that the EVT_CLOSE
handler is run when EVT_QUERY_END_SESSION is sent.

Also, is it always necessary to do the Veto check before shutting down,
or is that done just when outside factors try to shut it down?

Always do the check, it can't hurt. Alternatively, don't veto, and just
save everything (perhaps to temporary files) when you get
EVT_QUERY_END_SESSION.

- Josiah

ยทยทยท

John Salerno <johnjsal@NOSPAMgmail.com> wrote: