Link to home
Start Free TrialLog in
Avatar of karen021897
karen021897

asked on

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
Avatar of Madshi
Madshi

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.
Avatar of karen021897

ASKER

WinNT
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
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).
It won't work under NT
:-(
ASKER CERTIFIED SOLUTION
Avatar of Madshi
Madshi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks