How to turn off monitor? 
Author Message
 How to turn off monitor?

Hi there,

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

Greetings Stefan.



Wed, 18 Jun 1902 08:00:00 GMT  
 How to turn off monitor?


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


  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


  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.



Wed, 18 Jun 1902 08:00:00 GMT  
 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



Wed, 18 Jun 1902 08:00:00 GMT  
 How to turn off monitor?
: 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



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. TURNING OFF THE MONITOR (Compaq, Notebook)

2. Turn off global variables

3. turn off global variables

4. turning off case sensitivity

5. turn off num lock, scroll lock

6. Turning the text cursor off

7. Turn off Pcspeaker

8. Turning the text cursor off

9. How to turn off the cursor

10. Turn off pc-speaker?

11. turn off keyboard-delay??

12. Turning the screen off

 

 
Powered by phpBB® Forum Software