--- ---

You may be thinking how can I use this procedure. Well I used it in a program where I could send commands to a remote machine.

procedure LogOff;
begin
  ExitWindowsEx(EWX_LOGOFF, 0);
end;
Note
No "reason" code was passed to the second parameter of the ExitWindowsExfunction. This is not recommended by Microsoft – See the MSDN entry for ExitWindowsEx.