Board index » delphi » How to turn off monitor?

How to turn off monitor?

Hi there,

how can I turn off (green power function) my monitor
under TP?

Greetings Stefan.

 

Re:How to turn off monitor?


On Sat, 10 Apr 1999 08:29:01 GMT, sks2...@online.de (SuperStone)
wrote:

Quote
>Hi there,

>how can I turn off (green power function) my monitor
>under TP?

>Greetings Stefan.

Here is some source code which can put the monitor in different power
states using VBE power management. The information about VBE/PM came
ofcourse from Ralph Brown's interrupt list.

***********************************************************************************
program VBEPM;

{$X+} (* turn on extended syntax *)
{$G+} (* turn on 286 syntax, needed for "shr bh, 4" *)

uses crt;

const
  On        = 0;
  StandBy   = 1;
  Suspend   = 2;
  Off       = 4;
  ReducedOn = 8; (* for flat screens *)

type
  CapsTp = record
    Version            : word;
    StandBySupported,
    SuspendSupported,
    OffSupported,
    ReducedOnSupported : boolean;
  end;

function GetCaps(var Caps : CapsTp) : boolean;
  (* returns True if VBE/PM is supported *)
  const
    StandByMask   = 1;
    SuspendMask   = 2;
    OffMask       = 4;
    ReducedOnMask = 8;
  var
    Result : byte;
    SupportedStates : byte;
  begin
    asm
      mov  ax, 4f10h (* VBE/PM *)
      xor  bl, bl    (* get capabilities *)
      xor  di, di
      mov  es, di
      int  10h
      mov  [SupportedStates], bh
      mov  bh, bl    (* BL = VBE/PM version (bits 7-4: major, bits
3-0: minor) *)
      shr  bh, 4     (* BH = major version number *)
      and  bl, 0fh   (* BL = minor version number *)
      les  di, Caps
      mov  es:[di], bx
      xor  al, 4fh
      or   al, ah
      mov  [Result], al
    end;
    with Caps do
    begin
      StandBySupported   := (SupportedStates and StandByMask)   <> 0;
      SuspendSupported   := (SupportedStates and SuspendMask)   <> 0;
      OffSupported       := (SupportedStates and OffMask)       <> 0;
      ReducedOnSupported := (SupportedStates and ReducedOnMask) <> 0;
    end;
    GetCaps := Result = 0;
  end;

function SetDisplayPowerState(State : byte) : boolean;assembler;
  (* returns True if VBE/PM is supported *)
  asm
    mov  ax, 4f10h   (* VBE/PM *)
    mov  bl, 1       (* set display power state *)
    mov  bh, [State]
    int  10h
    xor  al, 4fh
    or   al, ah
    mov  al, 0
    jnz  @Error
    inc  ax
@Error:
  end;

function GetDisplayPowerState(var State : byte) : boolean;assembler;
  (* returns True if VBE/PM is supported *)
  asm
    mov  ax, 4f10h   (* VBE/PM *)
    mov  bl, 2       (* set display power state *)
    int  10h
    les  di, State
    mov  es:[di], bh
    xor  al, 4fh
    or   al, ah
    mov  al, 0
    jnz  @Error
    inc  ax
@Error:
  end;

var
  Caps  : CapsTp;
  State : byte;

begin
  ClrScr;
  if not GetCaps(Caps) then
    Writeln('VBE/PM not supported')
  else
  begin
    with Caps do
    begin
      writeln('VBE/PM v',Hi(Caps.Version),'.',Lo(Caps.Version),'
detected');
      writeln('Supported:');
      writeln('  Standby    : ',StandBySupported);
      writeln('  Suspend    : ',SuspendSupported);
      writeln('  Off        : ',OffSupported);
      writeln('  ReducedOn  : ',ReducedOnSupported);
      writeln;
      if not GetDisplayPowerState(State) then
        writeln('Error with getting the power state')
      else
        writeln('Screen is on : ',State = On);
      if StandbySupported then
      begin
        writeln;
        writeln('Press a key to go standby and another press to get
back.');
        readkey;
        writeln('Standby successful: ',SetDisplayPowerState(StandBy));
        readkey;
        writeln('On successful     : ',SetDisplayPowerState(On));
      end;
    end;
 end;
end.

Re:How to turn off monitor?


SuperStone schrieb:

Quote
> Hi there,

> how can I turn off (green power function) my monitor
> under TP?

> Greetings Stefan.

procedure turn_off ;
begin
   port[ $3c4 ] : = 1 ;
   port[ $3c5 ] : = port[ $3c5 ] or 32 ;
end;

robin stoll
eat.st...@befree.ch

Re:How to turn off monitor?


Quote
SuperStone (sks2...@online.de) wrote:

: how can I turn off (green power function) my monitor
: under TP?

You can find pascal source to do that with any vga card
(no special bios required) in the pascal section of my web homepage.

Klaus
--
Klaus Hartnegg, Institut fuer Biophysik, Hansa-Strasse 9a, D-79104 Freiburg
hartn...@uni-freiburg.de   http://www.brain.uni-freiburg.de/~klaus/

Other Threads