System Delphi

procedure TForm1.Button1Click(Sender: TObject);
begin
{use EWX_LOGOFF to log off
use EWX_SHUTDOWN to shut down
use EWX_REBOOT to reboot
use EWX_FORCE to do a force command with a cobination of Power off, or Reboot or shutdown or logoff
use EWX_POWEROFF to power off
}
SetShutdownPrivilege(true) ;//set rights to use this pivrilege
if not ExitWindowsEx(EWX_FORCE + EWX_POWEROFF , 0) then
messagedlg('wasn''t able to shutdown PC!',mterror,[mbok],0);
SetShutdownPrivilege(false); //turn of rights
end;