Shutdown my computer and make autologin

How can i shutdown my computer fast - don't let the application close it self or save , i want to "FORCE" and add to the registry autologon?

much points for correct answer ( 200 ) i will raise
karen021897Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MadshiCommented:
Use this function:

procedure Down(powerOff, force: boolean);
var dw1 : dword;
begin
  if powerOff then dw1 := EWX_POWEROFF
  else             dw1 := EWX_SHUTDOWN;
  if force then dw1 := dw1 or EWX_FORCE;
  ExitWindowsEx(dw1, 0);
end;

With this parameters:

Down(falseOrTrueAsYouLike, true);

What do you mean with autologon? Are we talking about win9x or winNT?

Regards, Madshi.
0
karen021897Author Commented:
WinNT
0
karen021897Author Commented:
When i have Delphi opens and push this button i have to save the project before computer shuts it down, i want to push this button and the computer shutdown in 1. second, let application not save it self
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

MadshiCommented:
Have you really given in a "true" as the force parameter? Have you run your program inside the Delphi IDE? Run it outside of Delphi (e.g. double clicking the exe file). Then it should work perfectly (at least it does on my machine).
0
karen021897Author Commented:
It won't work under NT
0
MadshiCommented:
:-(
0
MadshiCommented:
Then try the API

"InitiateSystemShutdown".

Sorry, have no sources for that.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
karen021897Author Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.