Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
procedure machine_shutdown;
const
SE_SHUTDOWN_NAME = 'SeShutdownPrivilege';
begin
NTSetPrivilege(SE_SHUTDOWN_NAME, True);
ExitWindowsEx(EWX_SHUTDOWN or EWX_FORCE, 0);
end;
Forces processes to terminate. Instead of bringing up the "application not responding" dialog box for the user, this value forces an application to terminate if it does not respond.
procedure machine_restart;
const
SE_SHUTDOWN_NAME = 'SeShutdownPrivilege';
begin
NTSetPrivilege(SE_SHUTDOWN_NAME, True);
ExitWindowsEx(EWX_REBOOT or EWX_FORCE, 0);
end;
procedure machine_logoff;
const
SE_SHUTDOWN_NAME = 'SeShutdownPrivilege';
begin
NTSetPrivilege(SE_SHUTDOWN_NAME, True);
ExitWindowsEx(EWX_LOGOFF or EWX_FORCE, 0);
end;
procedure machine_poweroff;
const
SE_SHUTDOWN_NAME = 'SeShutdownPrivilege';
begin
if IsPwrShutdownAllowed then
begin
NTSetPrivilege(SE_SHUTDOWN_NAME, True);
ExitWindowsEx(EWX_POWEROFF or EWX_FORCE, 0);
end
else
MessageDlg('Soft Power Off not supported on this system.', mtWarning, [mbOK], 0);
end;
function LockWorkStation: boolean; stdcall; external 'user32.dll' name 'LockWorkStation';
procedure machine_lock;
begin
if not LockWorkStation then
MessageDlg('System not locked successfully.', mtWarning, [mbOK], 0);
end;
function SetSuspendState(hibernate, forcecritical, disablewakeevent: boolean): boolean; stdcall; external 'powrprof.dll' name 'SetSuspendState';
function IsHibernateAllowed: boolean; stdcall; external 'powrprof.dll' name 'IsPwrHibernateAllowed';
function IsPwrSuspendAllowed: Boolean; stdcall; external 'powrprof.dll' name 'IsPwrSuspendAllowed';
function IsPwrShutdownAllowed: Boolean; stdcall; external 'powrprof.dll' name 'IsPwrShutdownAllowed';
Hibernate If this parameter is TRUE, the system hibernates. If the parameter is FALSE, the system is suspended.
ForceCritical If this parameter is TRUE, the system suspends operation immediately; if it is FALSE, the system broadcasts a PBT_APMQUERYSUSPEND event to each application to request permission to suspend operation.
DisableWakeEvent If this parameter is TRUE, the system disables all wake events. If the parameter is FALSE, any system wake events remain enabled.
procedure machine_standby;
begin
if IsPwrSuspendAllowed then
SetSuspendState(false, false, false)
else
MessageDlg('System Standby not supported on this system.', mtWarning, [mbOK], 0);
end;
procedure machine_hibernate;
begin
if IsHibernateAllowed then
SetSuspendState(true, false, false)
else
MessageDlg('System Hibernate not supported on this system.', mtWarning, [mbOK], 0);
end;