There is the procedure Exitwindows; here is the help
:
function ExitWindows(Reserved: LongInt; ReturnCode: Word): Bool;
The ExitWindows function can restart Windows, terminate Windows and return control to MS-DOS, or terminate Windows and restart the system. Windows sends the WM_QUERYENDSESSION message to notify all applications that a request has been made to restart or terminate Windows. If all applications "agree" to terminate, Windows sends the WM_ENDSESSION message to all applications before terminating.
Parameter Description
ReturnCode Specifies whether Windows should restart, terminate and return control to MS-DOS, or terminate and restart the system. The high-order word of this parameter should be zero. The low-order word specifies the return value to be passed to MS-DOS when Windows terminates. The low-order word can be one of the following values:
Value Meaning
EW_REBOOTSYSTEM Causes Windows to terminate and the system to restart.
EW_RESTARTWINDOWS Causes Windows to restart.
Reserved Reserved; must be zero.
Returns
Returns zero if one or more applications refuse to terminate. The function does not return a value if all applications agree to be terminated.
Also for loading : write in a procedure
: regsavekey . then while holding the control button press left click.You should be in the windows unit.There are some functions here but i cannot make them work.For example logonuser.
ps. if you know how to use them or you find out then by all means please let me know.