Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Switch off

Status
Not open for further replies.

drfb

Programmer
Jul 5, 2002
23
Dear All,
I have a little problem. I have made a program and I have seen that if someone switches off the pc I lose all the data, so my question is : is it possible to disable the "switching off" of the pc through a programme?
Probably it's impossible but ..... never say never!
Thank you,
FRancesco

 
I know that when You make a "start-button"-power-down or similar a general call to all running processes comes around and they are commanded to shut down. I do have som recollection that it's possible to reply with a "no way buster", look in the Help ("OnCloseQuery").

I would personally use that call to save the datas but we all do think differently. Totte
 
Thank you very much for your help;
I didn't Know ("OnCloseQuery") and I have seen that it is very useful. I'm thinking to create a programme with which could be possible to able/disable the power-button of the PC. Could you know if it is possible?
Thank you again,
Francesco
 
That is dependent on your Hardware. If you have a soft switch probably it could be done, but than there is must of a 2nd "mechanical" switch to cut off the Powersupply and this switch must be indpendent of the Software to avoid accidents. This Switch cannot be disabled.
hnd
hasso55@yahoo.com

 
I'm with hnd, when my PC hangs (Windows you knows....) the hardware is designed to cut power when i hold it in fore a while and that's nothing you can chance from a program, that's solder job! Totte
 
If I choose to shut my computer off with
the power switch before I save my data,
thats just to bad. No programmer can protect
me from my own stupidity in such cases.
the most you can do is to to have an auto
save feature working to periodically save
data for me. You can save all data on program
close by using the onclose method which should
help when there is an undisiplined shut down
via the start menu.
 
OK, it's true, is impossible to check it by software.
Thank you again for the help.....
Franz
 
yea theres also the issue of the power cord? can't very well make a program to keep it plugged into the wall. You should just save your data in the OnCloseQuery. Cyprus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top