System Delphi

//drony@mynet.com
// icq:266148308
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
btnShutDown: TButton;
btnReboot: TButton;
btnLogOff: TButton;
btnForceDown: TButton;
btnForceReboot: TButton;
btnMonitorOff: TButton;
btnSuspend: TButton;
procedure btnLogOffClick(Sender: TObject);
procedure btnShutDownClick(Sender: TObject);
procedure btnRebootClick(Sender: TObject);
procedure btnForceDownClick(Sender: TObject);
procedure btnForceRebootClick(Sender: TObject);
procedure TimerEx1Timer(Sender: TObject);
procedure btnMonitorOffClick(Sender: TObject);
procedure btnSuspendClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.btnLogOffClick(Sender: TObject);
begin
If ExitWindowsEx(EWX_LOGOFF,1)=False then
ShowMessage('Uable to comply !');
end;
procedure TForm1.btnShutDownClick(Sender: TObject);
begin
If ExitWindowsEx(EWX_SHUTDOWN,1)=False then
ShowMessage('Uable to comply !');
end;
procedure TForm1.btnRebootClick(Sender: TObject);
begin
If ExitWindowsEx(EWX_REBOOT,1)=False then
ShowMessage('Uable to comply !');
end;
procedure TForm1.btnForceDownClick(Sender: TObject);
begin
If ExitWindowsEx(EWX_SHUTDOWN + EWX_FORCE,1)=False then
ShowMessage('Uable to comply !');
end;
procedure TForm1.btnForceRebootClick(Sender: TObject);
begin
If ExitWindowsEx(EWX_REBOOT + EWX_FORCE,1)=False then
ShowMessage('Uable to comply !');
end;
procedure TForm1.TimerEx1Timer(Sender: TObject);
begin
If ExitWindowsEx(EWX_SHUTDOWN + EWX_FORCE,1)=False then
ShowMessage('Uable to comply !');
end;
procedure TForm1.btnMonitorOffClick(Sender: TObject);
begin
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 0);
end;
procedure TForm1.btnSuspendClick(Sender: TObject);
begin
Keybd_event(8,0,0,0);
Keybd_event(95,0,0,0);
end;
end.