windows application saving

hi all,
my problem is this that when an UPS goes in backup mode then system shut down suddenly. mean while files in which we were working lost the data.
now i have to save data automatically before shut down.
please help me
[235 byte] By [vdubey] at [2007-11-19 21:53:14]
# 1 Re: windows application saving
Try handling WM_QUERYENDSESSION ( http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shutdown/base/wm_queryendsession.asp) message in your main application's window.

Save data then return TRUE to allow application termination.
ovidiucucu at 2007-11-9 13:22:00 >
# 2 Re: windows application saving
thanks for your reply,
your reply is near to my problem, your guidence may be help ful to me,
i am try by using your concept.
i want to tell you that i am new .
so that its y request to you please clearify and tell me in briefle,
can u plz tell me exact lines of code for solution.
vdubey at 2007-11-9 13:23:00 >
# 3 Re: windows application saving
does your application have a top-level window ? ( Does it have a UI ? )
If it does, please handle WM_QUERYENDSESSION for the window and do the necessary.

If your app doesn't have a window, consider having one, albeit hidden, and handle the same message for it.
kirants at 2007-11-9 13:23:57 >
# 4 Re: windows application saving
thanks to all of u for their suggestion.
but by using "WM_QUERYENDSESSION" i am successfull to shut down my system but not success to save aal the aaplication that are open in LOGON session.
my main aim is to save of all the files at the time of shutdown
please help me as soon as possible.
thanks
vdubey at 2007-11-9 13:25:03 >