function ExitWindowsEx(dwFlags: DWord;dwReason: DWord): WINBOOL; stdcall; external 'aygshell.dll' name 'ExitWindowsEx';
//dwReason ; always 0
//dwflags ; 2 for reboot, 8 for shutdown
I tried the above with WINCE 4.2 net and it fails with message not a vaild windows application.
The code below partially works Eg reset works and suspend probably works but I can't get the system out of suspend to prove it.
const
//some of consts already found in Windows
POWER_STATE_ON = $00010000;
POWER_STATE_OFF = $00020000;
POWER_STATE_SUSPEND = $00200000;
POWER_STATE_RESET = $00800000;
POWER_FORCE = 4096;
function SetSystemPowerState(psState: PWideChar; StateFlags: DWORD; Options : DWORD):DWORD;
stdcall; external 'coredll.dll' name 'SetSystemPowerState';
Ex usage
SetSystemPowerState(nil, POWER_STATE_SUSPEND, POWER_FORCE);