home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / maj / swag / desqview.swg < prev    next >
Text File  |  1994-05-25  |  26KB  |  1 lines

  1. SWAGOLX.EXE (c) 1993 GDSOFT  ALL RIGHTS RESERVED 00005         DESQVIEW ROUTINES                                                 1      05-28-9313:37ALL                      SWAG SUPPORT TEAM        DESQVIEW.PAS             IMPORT              39     tΦ% { Does anyone know the routine For making a Program DV aware, and if itπ finds it, can you get it to make calls to it instead of Dos?π}πHere is a desqview Unit I have used in the past.ππUnit DESQVIEW ;ππ{$O+,F+}ππInterfaceππUses Dos ;ππVarπ  DV_ACTIVE    : Boolean ;          { True if running under DESQview     }π  Win_ACTIVE   : Boolean ;          { True if Windows 3.x Enhanced Mode  }π  DV_VERSION   : Word ;             { desqVIEW version number            }π  DV_VSEG      : Word ;π  DV_VMODE     : Byte Absolute $0040:$0049 ;π  DV_VWIDTH    : Byte ;π  DV_VROWS     : Byte ;π  DV_VofS      : Word ;πππProcedure DV_RQM   ;                { Give up the rest of our timeslice  }πProcedure DV_begin_CRITICAL ;       { Turn Task Switching off.           }πProcedure DV_end_CRITICAL ;         { Turn switching back on.            }πProcedure DV_VIDEO_BUFFER ;         { Set Global Video Variables         }πFunction  DV_Window_NUMBER : Byte ; { Returns Window Number              }πProcedure DV_COMMON_MEMorY(Var AVAIL, LARGEST, toTAL: Word) ;πProcedure DV_CONV_MEMorY  (Var AVAIL, LARGEST, toTAL: Word) ;πProcedure DV_EMS_MEMorY   (Var AVAIL, LARGEST, toTAL: Word) ;πProcedure DV_FASTWrite    (X,Y: Word; STR: String; FG,BG: Word) ;ππImplementationππVarπ  REG     : Registers ;ππProcedure DV_RQM ;ππbeginπ  if DV_ACTIVE then beginπ    Asmπ      mov  ax, 1000hπ      int  15hπ    end ;π  end else beginπ    if Win_ACTIVE then beginπ      Asmπ        mov  ax, 1680hπ        int  2fhπ      end ;π    end ;π  end ;πend { dv_rqm };ππProcedure DV_begin_CRITICAL ;ππbeginπ  if DV_ACTIVE then beginπ    Asmπ      mov   ax, $101bπ      int   15hπ    end ;π  end else beginπ    if Win_ACTIVE then beginπ      Asmπ        mov  ax, 1681hπ        int  2fhπ      end ;π    end ;π  end ;πend ; { dv_begin_critical }ππProcedure DV_end_CRITICAL ;ππbeginπ  if DV_ACTIVE then beginπ    Asmπ      mov   ax, $101cπ      int   15hπ    end ;π  end else beginπ    if Win_ACTIVE then beginπ      Asmπ        mov  ax, $1682π        int  2fhπ      end ;π    end ;π  end ;πend ; { dv_end_critical }ππProcedure DV_VIDEO_BUFFER ;ππbeginπ  if DV_ACTIVE then beginπ    Asmπ      mov  ax, $2b02π      mov  bx, $4445  ; { DE }π      mov  dx, $5351  ; { SQ }π      int  21hπ      mov  DV_VSEG, dxπ      mov  DV_VWIDTH, blπ      mov  DV_VROWS, bhπ      mov  DV_VofS, 0π    end ;π  end else beginπ    if (DV_VMODE = 7) then DV_VSEG := $b000 else DV_VSEG := $b800 ;π    DV_VWIDTH := memw[$0040:$004a] ;π    DV_VROWS  := 25 ;π    DV_VofS   := memw[$0040:$004e] ;π  end ;πend ; { dv_video_buffer }ππFunction DV_Window_NUMBER ;ππbeginπ  if DV_ACTIVE then beginπ    Asmπ      mov   ax, $de07π      int   15hπ      mov  @RESULT, alπ    end ;π  end else beginπ    DV_Window_NUMBER := 0 ;π  end ;πend ;ππProcedure DV_COMMON_MEMorY ;ππbeginπ  if DV_ACTIVE then beginπ    Asmπ      mov  ax, $de04π      int  15hπ      les  di, AVAILπ      mov  es:[di], bxπ      les  di, LARGESTπ      mov  es:[di], cxπ      les  di, toTALπ      mov  es:[di], dxπ    end ;π  end else beginπ    AVAIL := 0 ;π    LARGEST := 0 ;π    toTAL := 0 ;π  end ;πend ;ππProcedure DV_CONV_MEMorY ;ππbeginπ  if DV_ACTIVE then beginπ    Asmπ      mov  ax, $de05π      int  15hπ      les  di, AVAILπ      mov  es:[di], bxπ      les  di, LARGESTπ      mov  es:[di], cxπ      les  di, toTALπ      mov  es:[di], dxπ    end ;π  end else beginπ    AVAIL := 0 ;π    LARGEST := 0 ;π    toTAL := 0 ;π  end ;πend ;ππProcedure DV_EMS_MEMorY ;ππbeginπ  if DV_ACTIVE then beginπ    Asmπ      mov  ax, $de06π      int  15hπ      les  di, AVAILπ      mov  es:[di], bxπ      les  di, LARGESTπ      mov  es:[di], cxπ      les  di, toTALπ      mov  es:[di], dxπ    end ;π  end else beginπ    AVAIL := 0 ;π    LARGEST := 0 ;π    toTAL := 0 ;π  end ;πend ;ππProcedure DV_FASTWrite ;ππVarπ  I      : Word ;ππbeginπ  X := DV_VofS + ((Y-1) * DV_VWIDTH + (X-1)) * 2 ;π  For I := 1 to length(STR) do beginπ    MEMW[DV_VSEG:X] := (((BG shl 4) + FG) shl 8) + ord(STR[I]) ;π    X := X + 2 ;π  end ;πend ;ππbegin { main }π  REG.AX := $2b01 ;π  REG.CX := $4445 ;  { DE }π  REG.DX := $5351 ;  { SQ }π  intr($21,REG) ;ππ  Win_ACTIVE := False ;π  DV_ACTIVE := (REG.AL <> $ff) ;ππ  DV_VERSION := 0 ;π  if DV_ACTIVE then beginπ    DV_VERSION := REG.BX ;π    REG.AX := $de0b ;π    REG.BX := $0200 ;  { Minimum of Desqview 2.00 }π    intr($15,REG) ;π  end else beginπ    REG.AX := $1600 ;π    intr($2f,REG) ;π    Case REG.AL ofπ      $00 : ; { An enhanced Windows API is not Running }π      $80 : ; { An enhanced Windows API is not Running }π      $01 : ; { Windows / 386 Version 2.x              }π      $ff : ; { Windows / 386 Version 2.x              }π      else beginπ        Win_ACTIVE := True ;π        DV_VERSION := swap(REG.AX) ;π      end ;π    end ;π  end ;ππ  DV_VIDEO_BUFFER ;πend. { main }π                                                                          2      05-28-9313:37ALL                      SWAG SUPPORT TEAM        DV-VIDEO.PAS             IMPORT              7      tw\ {π> Has anyone done any work With DV's virtual screen?  Someplace Iπ> used to have the address For it, but I seem to have lost it.  Doesπ> anybody know what it is?ππ> What I'm trying to do is bypass TJT's direct screen Writes byπ> replacing the BaseOfScreen Pointer With the one For DV's virtualπ> screen. if I can't do that then I'm going to have to make anotherπ> attempt at rewriting the assembly level screen routines.π}ππFunction DV_Video_Buffer;πbeginπ  Reg.AH := $0F;π  INTR($10, Reg);π  if Reg.AL = 7 thenπ    Reg.ES := $B000π  elseπ    Reg.ES := $B800;π  if DV_Loaded thenπ  beginπ    Reg.DI := 0;π    Reg.AX := $FE00;π    INTR($10, Reg);π  end;π  DV_Video_Buffer := Reg.ES;πend;π                                                                               3      11-26-9318:18ALL                      FRED COHEN               Time SLICES for OS/2 & DVIMPORT              23     t└ª {πFrom: FRED COHENπ      Time Slices...ππlooking for routines for giving up time slices toπvarious multi-taskers, mainly DV and OS/2.  Please eitherπpost them if they are small enough, or tell me where I canππYou will need turbo pascal 6.0+ for this to compile.  It is easy toπconvert over to regular pascal though.π}ππConstππ  MDOS = 0;  { DOS               }π  OS2  = 1;  { OS/2 is installed }π  WIN  = 2;  { Windoze           }π  DV   = 3;  { DesqView          }ππVarππ  Ops            : Byte;    { Operating System OS/2/DOS/WIN/DV}πππPROCEDURE giveslice; Assembler; {Gives up remainder of clock cycleπ                                 under dos, windows, os/2 }π  asmπ    CMP ops,MDos { Compare to DOS }π    JE @MSDOS    { Jump if = }π    CMP ops,Dv   { Compare to Desqview }π    JE @DESQVIEW { Jump if = }π    CMP ops, Win { Compare to Windows }π    JE @WINOS2   { Jump if = }π    CMP ops, OS2 { Compart OS/2 }π    JE @WINOS2   { Jump if = }π    JMP @NONE    { None found, Jump to End }πππ @MSDOS:π    INT 28h   { Interupt 28h }π    JMP @NONE { Jump to the end }ππ @DESQVIEW:π    MOV ax,1000h { AX = 1000h }π    INT 15h      { Call Interupt 15h }π    JMP @NONE    { Jump to the end }ππ @WINOS2:π    MOV AX, 1680h { AX = 1680h }π    INT 2Fh       { Call Interupt 2Fh for Win-OS/2 TimeSlice }ππ @NONE:ππend; {GiveSlice}ππ{***********}ππPROCEDURE checkos; Assembler;π{ Currently Supports DesqView, Microsoft Windows and IBM's OS/2 }ππasmπ  mov ops, MDos { Default DOS }π  mov ah, 30h   { AH = 30h }π  int 21h  { dos version }π  cmp al, 14hπ  jae @IBMOS2 { Jump if >= to 20 }πππ  mov ax,2B01hπ  mov cx,4445hπ  mov dx,5351hπ  int 21h { Desqview Installed? }π  cmp al, 255π  jne @DesqView { Jump if AL <> 255 }ππ  mov ax,160Ahπ  int 2Fh { Windows Install?}π  cmp ax, 0hπ  je @Windows { If = Jump to Windows }π  jmp @Finish { Nothing found, go to the end }ππ@IBMOS2:π  mov Ops, Os2  { Set OS Value }π  jmp @Finishππ@DesqView:π  mov ops, Dv   { Set OS Value }π  jmp @Finishππ@Windows:π  mov ops, win  { Set OS Value }π  jmp @Finishππ@FINISH:πend; { checkos }ππ{***********  MORE  ********}ππprocedure GiveTimeSlice;  ASSEMBLER;πasm     { GiveTimeSlice }π  cmp   MultiTasker, DesqViewπ  je    @DVwaitπ  cmp   MultiTasker, Windowsπ  je    @WinOS2waitπ  cmp   MultiTasker, OS2π  je    @WinOS2waitπ  cmp   MultiTasker, NetWareπ  je    @Netwarewaitπ  cmp   MultiTasker, DoubleDOSπ  je    @DoubleDOSwaitππ@Doswait:π  int   $28π  jmp   @WaitDoneππ@DVwait:π  mov   AX, $1000π  int   $15π  jmp   @WaitDoneππ@DoubleDOSwait:π  mov   AX, $EE01π  int   $21π  jmp   @WaitDoneππ@WinOS2wait:π  mov   AX, $1680π  int   $2Fπ  jmp   @WaitDoneππ@Netwarewait:π  mov   BX, $000Aπ  int   $7Aππ@WaitDone:πend;    { TimeSlice }ππ                                                                                                                    4      02-09-9411:50ALL                      JOEL BERGEN              DESQVIEW Support Unit    IMPORT              17     t   (* ------------------------------------------------------------ *)ππ{ This unit adds support for the DESQview" multi-tasking enviromentπ  By Joel Bergen  last revised: 9/17/90  }ππ{$A+,B-,D+,E+,F-,I+,L+,N-,O+,R+,S+,V+}π{$M 1024,0,0}ππUNIT DESQview;ππINTERFACEππUSES DOS;ππVARπ  Dv_Loaded  : BOOLEAN; {True if running under DESQview                  }π  Dv_Version : WORD;    {DESQview" version number                        }π                        {Returns "0" if DESQview" is not loaded.         }π                        {Use:                                            }π                        {WRITELN(Hi(Dv_Version)+Lo(Dv_Version)/100:4:2); }π                        {to display the version of "Desqview" correctly. }πππFUNCTION  Dv_There : BOOLEAN;     {True if Desqview loaded. Sets Dv_Version}πPROCEDURE Dv_Pause;               {Give up the rest of our timeslice}πPROCEDURE Dv_Begin_Critical;      {Turn switching off for time critical ops}πPROCEDURE Dv_End_Critical;        {Turn switching back on}πFUNCTION  Dv_Video_Buffer : WORD; {returns address of video buffer}ππIMPLEMENTATIONππVARπ  Reg : REGISTERS;ππFUNCTION Dv_There;πBEGINπ  Reg.CX:=$4445;π  Reg.DX:=$5351;π  Reg.AX:=$2B01;π  INTR($21,Reg);π  Dv_Loaded:=(Reg.AL<>$0FF);π  IF Dv_Loaded THEN Dv_Version:=Reg.BX ELSE Dv_Version:=0;π  Dv_There:=Dv_Loaded;πEND;ππPROCEDURE Dv_Pause;πBEGINπ  IF DV_Loaded THEN BEGINπ    Reg.AX:=$1000;π    INTR($15,Reg);π  END;πEND;ππPROCEDURE Dv_Begin_Critical;πBEGINπ  IF DV_Loaded THEN BEGINπ    Reg.AX:=$101B;π    INTR($15,Reg);π  END;πEND;ππPROCEDURE Dv_End_Critical;πBEGINπ  IF DV_Loaded THEN BEGINπ    Reg.AX:=$101C;π    INTR($15,Reg);π  END;πEND;ππFUNCTION DV_Video_Buffer;πBEGINπ  Reg.AH:=$0F;π  INTR($10,Reg);π  IF Reg.AL=7 THEN Reg.ES:=$B000 ELSE Reg.ES:=$B800;π  IF DV_Loaded THEN BEGINπ    Reg.DI:=0;π    Reg.AX:=$FE00;π    INTR($10,Reg);π  END;π  DV_Video_Buffer:=Reg.ES;πEND;ππBEGIN { Checks to see if desqview is loaded at startup. }π  Dv_Loaded:=Dv_There;πEND.ππ                                                                      5      05-25-9408:11ALL                      MIKE DICKSON             DESQVIEW API Routines    SWAG9405            118    t   {π********************************************************************π*                                                                  *π*  DESQview API routines                                           *π*  for Turbo Pascal 6.0                                            *π*  by Jonathan L. Zarate                                           *π*  Released to the Public Domain                                   *π*                                                                  *π********************************************************************π}π{π  ** Please refer to Ralf Brown's Interrupt Listπ  ** for additional information.π}ππUnit DV;ππInterfaceππTypeπ Msg_Write2 = recordπ               len : longint;π               str : pointer;π              end;π Msg_Write2_NewWin = recordπ                      len    : longint;π                      str    : pointer;π                      handle : pointer;π                     end;ππconstπ{ Stream Types }π WinStream     = $00;π QueryStream   = $01;π ManagerStream = $10;ππ{ Manager Streams }π MStream_MoveHoriz    = $00;     { horizontal movement  }π MStream_MoveVert     = $01;     { vertical movement  }π MStream_ChangeWidth  = $02;     { width change  }π MStream_ChangeHeight = $03;     { height change  }π MStream_ScrollHoriz  = $04;     { horizontal scroll  }π MStream_ScrollVert   = $05;     { vertical scroll  }π MStream_CloseWindow  = $06;     { close window option }π MStream_HideWindow   = $07;     { hide window option }π MStream_FreezeApp    = $08;     { freeze window option }π MStream_ScissorsMenu = $0E;     { scissors menu }π MStream_MainMenu     = $10;     { main DESQview menu }π MStream_SwitchWinMenu= $11;     { switch windows menu }π MStream_OpenWinMenu  = $12;     { open windows menu }π MStream_QuitMenu     = $13;     { quit menu }ππ{ Window/Query streams }π WStream_CursorRow    = $A0;     { Cursor row }π WStream_CursorColumn = $A1;     { Cursor Column }π WStream_ScrollTopRow = $A2;     { Top row of scrolling region }ππ{ DVError Constants }π DVErrorMouEither   = 00;        { use either mouse buttons to remove window }π DVErrorMouRight    = 32;        { use right mouse button to remove window }π DVErrorMouLeft     = 64;        { use left mouse button to remove window }π DVErrorBeep        = 128;       { beep on error }π{ ----------------------- }ππconstπ InDV        : boolean = false;  { In DESQview flag }π DV_Version  : word = $0000;     { DESQview version }ππvarπ DVArray     : array[1..80] of byte; { stream array }ππfunction  DVInit : pointer;πprocedure DVGetVersion;πfunction  DVGetShadowSeg( VideoSeg : word ) : word;πprocedure DVPause;πprocedure DVBeginC;πprocedure DVEndC;πfunction  DVAPPNum : word;πprocedure DVSendMsg( Handle : pointer; _bh, _bl : byte; size : word; var param);πprocedure DVStream( Handle : pointer; mode : byte; params : string );πfunction  DVGetHandle( HandleType : byte ) : pointer;πprocedure DVSound( Handle : pointer; frequency, duration : word );πprocedure DVError( Handle : pointer; xsize, ysize : byte; msg : string; params:byte);πprocedure DVAPILevel( major, minor : byte );πprocedure DVWrite( Handle : pointer; s : string );πprocedure DVWriteln( Handle : pointer; s : string );πfunction  DVNewWin( x, y : word ) : pointer;πprocedure DVFree( var Handle : pointer );πfunction  DVTimer_New : pointer;πprocedure DVTimer_Start( Handle : pointer; Time : longint );πfunction  DVTimer_Len( Handle : pointer ) : longint;π{ ---- Window Streams ---- }πprocedure DVClear( Handle : pointer );πprocedure DVRedraw( Handle : pointer );πprocedure DVResize( Handle : pointer; x, y : byte );πprocedure DVMove( Handle : pointer; x, y : shortint );πprocedure DVTitle( Handle : pointer; title : string );πprocedure DVMove2( Handle : pointer; x, y : shortint );πprocedure DVResize2( Handle : pointer; x, y : shortint );πprocedure DVSetAttr( Handle : pointer; color : byte );πprocedure DVFrameAttr( Handle : pointer; color : byte );πprocedure DVFrameOn( Handle : pointer; b : boolean );πprocedure DVWinUnHide( Handle : pointer );πprocedure DVWinHide( Handle : pointer );πprocedure DVGotoXY( Handle : pointer; x, y : byte );πprocedure DVSetVirtualWinSize( Handle : pointer; x, y : byte );π{ -- Manager Streams -- }πprocedure DVAllow( Handle : pointer; command : byte );πprocedure DVDisallow( Handle : pointer; command : byte );πprocedure DVForeOnly( Handle : pointer; b : boolean );πprocedure DVMinWinSize( Handle : pointer; x, y : byte );πprocedure DVMaxWinSize( Handle : pointer; x, y : byte );πprocedure DVForceForeground( Handle : pointer );πprocedure DVForceBackground( Handle : pointer );πprocedure DVTopProcess( Handle : pointer );πprocedure DVBottomProcess( Handle : pointer );π{ ---- Query Streams ---- }πprocedure DVQSize( Handle : pointer; var x, y : byte );πprocedure DVQPos( Handle : pointer; var x, y : shortint );πprocedure DVQVirtualWinSize( Handle : pointer; var x, y : byte );πfunction  DVWhereX( Handle : pointer ) : shortint;πfunction  DVWhereY( Handle : pointer ) : shortint;ππImplementationππfunction DVInit : pointer;πbeginπ { get DESQview version & get our window handle }π DVGetVersion;π if InDV then DVInit:=DVGetHandle(1);πend;ππprocedure DVGetVersion; assembler;πasmπ { get DESQview version/set InDV flag }π mov cx,'DE'π mov dx,'SQ'π mov ax,2b01hπ int 21hπ cmp al,0ffhπ je @GV1π mov DV_Version,bxπ mov InDV,Trueπ jmp @GV2π@GV1:π mov InDV,Falseπ@GV2:πend;ππfunction DVGetShadowSeg( VideoSeg : word ) : word; assembler;πasmπ { get task's shadow buffer & start shadowing }π mov ax,VideoSegπ mov es,axπ mov di,0π mov ah,0fehπ int 10hπ mov ax,esπ { di=offset ??don't know if used?? }πend;ππprocedure DVPause; assembler;πasmπ { give up CPU time }π mov ax,1000hπ int $15πend;ππprocedure DVBeginC; assembler;πasmπ { begin critical region }π mov ax,101bhπ int $15πend;ππprocedure DVEndC; assembler;πasmπ { end critical region }π mov ax,101chπ int $15πend;ππfunction DVAPPNum : word; assembler;πasmπ { get application's switch number }π mov ax,0de07hπ int 15hπend;ππprocedure DVSendMsg( Handle : pointer; _BH, _BL : byte;π                      size : word; var param ); assembler;πasmπ std           { string goes backwards }π mov dx,sp     { save sp }ππ mov cx,size   { load size of param }π jcxz @SM2     { if zero then don't push anything }ππ mov bx,ds     { save ds }ππ lds si,param  { load address of param }π add si,cx     { start from the top }π dec si        { minus 2 }π dec si        { ^^^^^^^ }π shr cx,1      { cx:=cx div 2 }π@SM1:π lodsw         { load 1 word }π push ax       { push it }π loop @SM1      { if cx > 0 loop }ππ mov ds,bx     { restore ds }π@SM2:π les di,Handle { get handle }π mov ax,es     { move es to ax for compare }π cmp ax,0      { if segment is 0 then }π je @SM3       { don't push handle }π push es       { push segment }π push di       { push offset }π@SM3:π mov ah,$12π mov bh,_bhπ mov bl,_blπ int $15       { call dv }ππ cld           { string goes forward }π mov ax,sp     { calculate the number of }π mov cx,dx     { returned parameter(s) }π sub cx,ax     { in stack }ππ jcxz @SMX      { exit if none }π les di,param  { load address of param }π add di,sizeπ shr cx,1      { cx:=cx div 2 }π@SM4:π pop axπ stoswπ loop @SM4π@SMX:πend;ππfunction DVGetHandle( HandleType : byte ) : pointer; assembler;πasmπ { return object handle }π mov ah,$12π mov bh,$00π mov bl,HandleTypeπ int $15π pop axπ pop dxπend;ππprocedure DVSound( Handle : pointer; frequency, duration : word ); assembler;πasmπ { generate a sound }π mov ax,$1019π mov bx,frequencyπ mov cx,duration   { in 18.2 ticks/sec }π int $15πend;ππprocedure DVError( handle : pointer; xsize, ysize : byte; msg : string; params: byte);πassembler;πasmπ { pop-up an error box }π {π   use DVERRORxxxxx for PARAMSπ   example: DVError(Handle1, 80, 25, 'Don't Touch That!',π                    DVErrorMouEither+DVErrorBeep);π }π mov ch,xsizeπ mov cl,ysize;π mov bh,paramsπ les dx,Handleπ mov dx,esπ les di,msgπ mov bl,es:[di]π inc diπ mov ax,$101Fπ int $15πend;ππprocedure DVAPILevel( major, minor : byte ); assembler;πasmπ { define the minimum API revision level than the program requires }π mov bh,majorπ mov bl,minorπ mov ax,0de0bhπ int 15hπend;ππprocedure DVStream( handle : pointer; mode : byte; params : string );πvarπ Msg : Msg_Write2;πbeginπ { send a stream of opcode(s) }π DVArray[1]:=$1B;π DVArray[2]:=mode; { stream mode }π DVArray[3]:=length(params);π DVArray[4]:=00;π move(params[1],DVArray[5],length(params));π with Msg doπ  beginπ   Str:=@DVArray;π   Len:=Length(params)+4;π  end;π DVSendMsg(Handle, $05, ord((handle=nil)), sizeof(Msg), Msg);π { Meaning of "ord((handle=nil))" }π { If handle=nil then return 1 else return 0 }πend;ππprocedure DVWrite( Handle : pointer; s : string );πvarπ Msg : Msg_Write2;πbeginπ { write a string }π with Msg doπ  beginπ   str:=@s[1];π   len:=length(s);π  end;π DVSendMsg(Handle, $05, Ord((Handle=Nil)),  Sizeof(Msg), Msg );πend;ππprocedure DVWriteln( Handle : pointer; s : string );πbeginπ DVWrite(Handle, s+#13#10 );πend;ππfunction DVNewWin( x, y : word ) : pointer;πvarπ Msg : Msg_Write2_NewWin;πbeginπ { allocate new window ( X and Y are the window's size & virtual size }π DVArray[1]:=$1B;π DVArray[2]:=$00;π DVArray[3]:=$04;π DVArray[4]:=$00;π DVArray[5]:=$E6;π DVArray[6]:=y; { Y-Size }π DVArray[7]:=x; { X-Size }π With Msg doπ  beginπ   Len:=$07;π   Str:=@DVArray;π   Handle:=Nil;π   DVSendMsg( Nil, $05, $01, Sizeof(Msg)-4, Msg);π   DVNewWin:=Handle;π  end;πend;ππprocedure DVFree( var Handle : pointer );πbeginπ { free a handle (close a window/free a timer/etc..) }π DVSendMsg(Handle, $02, $00, $00, Handle );π Handle:=Nil;πend;ππfunction DVTimer_New : pointer;πvarπ Handle : pointer;πbeginπ { allocate a new timer }π DVSendMsg( Nil, $01, $0B, $00, Handle );π DVTimer_New:=Handle;πend;ππprocedure DVTimer_Start( Handle : pointer; Time : longint );πbeginπ { start a timer countdown (TIME is in 1/100 of a second) }π DVSendMsg(Handle, $0a, $00, sizeof(Time), Time);πend;ππfunction DVTimer_Len( Handle : pointer ) : longint;πvarπ Len : longint;πbeginπ { get current timer value (in 1/100 of a second) }π DVSendMsg(Handle, $09, $00, $00, Len);π DVTimer_Len:=Len;πend;ππ{ ---- Window Streams ---- }ππprocedure DVClear( Handle : pointer );πbeginπ { clear window }π DVStream(Handle, WinStream, chr($E3))πend;ππprocedure DVRedraw( Handle : pointer );πbeginπ { redraw window }π DVStream(Handle, WinStream, chr($E4))πend;ππprocedure DVResize( Handle : pointer; x, y : byte );πbeginπ { resize window }π DVStream(Handle, WinStream, chr($C3)+chr(y)+chr(x));πend;ππprocedure DVMove( Handle : pointer; x, y : shortint );πbeginπ { move the window }π DVStream(Handle, WinStream, chr($C2)+chr(y)+chr(x))πend;ππprocedure DVTitle( Handle : pointer; title : string );πbeginπ { change window title }π DVStream(Handle, WinStream, chr($EF)+title[0]+title)πend;ππprocedure DVMove2( Handle : pointer; x, y : shortint );πbeginπ { set window position relative to the current position  }π { use negative (-1) values to move up/left }π DVStream(Handle, WinStream, chr($CA)+chr(y)+chr(x));πend;ππprocedure DVResize2( Handle : pointer; x, y : shortint );πbeginπ { set window size relative to the current size  }π { use negative (-1) values to shrink window }π DVStream(handle, WinStream, chr($CB)+chr(y)+chr(x));πend;ππprocedure DVSetAttr( Handle : pointer; color : byte );πbeginπ { set the output color }π DVStream(Handle, WinStream, chr($E2)+chr(color));πend;ππprocedure DVFrameAttr( Handle : pointer; color : byte );πbeginπ { set the frame color }π DVStream(Handle, WinStream, chr($ED)+chr($FF)+chr($08)+π          chr(color)+chr(color)+chr(color)+chr(color)+π          chr(color)+chr(color)+chr(color)+chr(color));πend;ππprocedure DVFrameOn( Handle : pointer; b : boolean );πbeginπ{ must use DVRedraw to remove the frame }π if b then DVStream(Handle, WinStream, chr($D6))π  else DVStream(Handle, WinStream, chr($D7))πend;ππprocedure DVWinUnHide( Handle : pointer );πbeginπ { unhide a window }π DVStream(Handle, WinStream, chr($D4));πend;ππprocedure DVWinHide( Handle : pointer );πbeginπ { hide a window }π DVStream(Handle, WinStream, chr($D5));πend;ππprocedure DVGotoXY( Handle : pointer; x, y : byte );πbeginπ { positions the cursor at X, Y }π DVStream(Handle, WinStream, chr($C0)+chr(y-1)+chr(x-1));πend;ππprocedure DVSetVirtualWinSize( Handle : pointer; x, y : byte );πbeginπ { set window's virtual size }π DVStream(Handle, WinStream, chr($AB)+chr(x));π DVStream(Handle, WinStream, chr($AA)+chr(y));πend;ππ{ ---- Query Streams ---- }ππprocedure DVQSize( Handle : pointer; var x, y : byte );πbeginπ { get the window size }π DVStream(Handle, QueryStream, chr($C3));π { result is in DVArray[6..7] }π y:=DVArray[6];π x:=DVArray[7];πend;ππprocedure DVQPos( Handle : pointer; var x, y : shortint );πbeginπ { get the window position }π DVStream(Handle, QueryStream, chr($C2));π { result is in DVArray[6..7] }π y:=DVArray[6];π x:=DVArray[7];πend;ππprocedure DVQVirtualWinSize( Handle : pointer; var x, y : byte );πbeginπ { get virtual window size }π DVStream(Handle, QueryStream, chr($AA));π Y:=DVArray[6];π DVStream(Handle, QueryStream, chr($AB));π X:=DVArray[6];πend;ππfunction DVWhereX( Handle : pointer ) : shortint;πbeginπ { return the cursor's X position }π DVStream( Handle, QueryStream, chr($A1) );π DVWhereX:=DVArray[6];πend;ππfunction DVWhereY( Handle : pointer ) : shortint;πbeginπ { return the cursor's Y position }π DVStream( Handle, QueryStream, chr($A0) );π DVWhereY:=DVArray[6];πend;ππ{ --- Manager Stream Procedures --- }ππprocedure DVAllow( Handle : pointer; command : byte );πbeginπ { disallow a command (see constants "MStream_xxxxxx") }π DVStream(Handle, ManagerStream, chr(command));πend;ππprocedure DVDisallow( Handle : pointer; command : byte );πbeginπ { disallow a command (see constants "MStream_xxxxxx") }π DVStream(Handle, ManagerStream, chr(command+$20));πend;ππprocedure DVForeOnly( Handle : pointer; b : boolean );πbeginπ { B=TRUE if application runs on foreground only }π if b then DVStream(Handle, ManagerStream, chr($86))π  else DVStream(Handle, ManagerStream, chr($87));πend;ππprocedure DVMinWinSize( Handle : pointer; x, y : byte );πbeginπ { define window's minimum size }π DVStream(Handle, ManagerStream, chr($88)+chr(y)+chr(x));πend;ππprocedure DVMaxWinSize( Handle : pointer; x, y : byte );πbeginπ { define window's maximum size }π DVStream(Handle, ManagerStream, chr($89)+chr(y)+chr(x));πend;ππprocedure DVForceForeground( Handle : pointer );πbeginπ { force process to run into foreground }π DVStream(Handle, ManagerStream, chr($C1));πend;ππprocedure DVForceBackground( Handle : pointer );πbeginπ { force process to run into background }π DVStream(Handle, ManagerStream, chr($C9));πend;ππprocedure DVTopProcess( Handle : pointer );πbeginπ { make current window topmost in process }π DVStream( Handle, ManagerStream, chr($C2) );πend;ππprocedure DVBottomProcess( Handle : pointer );πbeginπ { make current window bottom-most in process }π DVStream( Handle, ManagerStream, chr($CA) );πend;ππend.π