Click to See Complete Forum and Search --> : windows application saving


vdubey
May 19th, 2006, 06:17 AM
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

ovidiucucu
May 19th, 2006, 06:58 AM
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.

vdubey
May 20th, 2006, 07:20 AM
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 ******** and tell me in briefle,
can u plz tell me exact lines of code for solution.

kirants
May 20th, 2006, 11:44 AM
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.

vdubey
May 22nd, 2006, 02:24 AM
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