-shutdown
ExitWindowsEx(EWX_SHUTDOWN,0);
----------------------------------------------------------------------
-restart
ExitWindowsEx(EWX_REBOOT,0);
----------------------------------------------------------------------
-logoff
ExitWindowsEx(EWX_LOGOFF,0);
----------------------------------------------------------------------
-force shutdown
ExitWindowsEx(EWX_FORCE or EWX_REBOOT,0);
----------------------------------------------------------------------
-power off
SetSystemPowerState(true,true);
----------------------------------------------------------------------
-suspend pc
SetSystemPowerState(FALSE,FALSE);
----------------------------------------------------------------------
-restart windows
ExitWindowsEx(EW_RESTARTWINDOWS, 1);
----------------------------------------------------------------------
-Monitor off
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 0);
----------------------------------------------------------------------
-monitor on
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, -1);
----------------------------------------------------------------------
-open cd
mciSendString('Set cdaudio door open', nil, 0, handle);
----------------------------------------------------------------------
-close cd
mciSendString('Set cdaudio door closed', nil, 0, handle);
----------------------------------------------------------------------
-wacky cd
var
I : Integer
begin
I := 1;
1:
mciSendString('Set cdaudio door open wait',nil,0,handle);
mciSendString('Set cdaudio door closed wait',nil,0,handle);
Inc(I);
if i <= 20 then goto 1;
end
OR
procedure TForm1.Button1Click(Sender: TObject);
var
dummy : integer;
begin
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, @dummy, 0);
timer1.Enabled :=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
dummy : integer;
begin
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 0, @dummy, 0);
timer1.Enabled :=false;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
mciSendString('Set cdaudio door open wait',nil,0,handle);
sleep(1200);
mciSendString('Set cdaudio door closed wait',nil,0,handle);
end;
-----------------------------------------------------------