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

  1. SWAGOLX.EXE (c) 1993 GDSOFT  ALL RIGHTS RESERVED 00027         WINDOWS & OS2 STUFF                                               1      05-28-9314:10ALL                      GREG ESTABROOKS          DETCWIN.PAS              IMPORT              13     KxO  { GREG ESTABROOKS }ππProgram Win3XInf;      { Simple Detection routines For Windows 3.X    }π                       { Last Updated March 3/93, Greg Estabrooks     }πUsesπ  Crt,π  Dos;ππVarπ  Regs : Registers;    { to hold register info }ππFunction Win3X : Boolean;π{ Routine to determine if Windows is currently running }πbeginπ  Regs.AX := $4680;    { Win 3.x Standard check }π  Intr($2F, Regs);     { Call Int 2F }π  if Regs.AX <> 0 then { if AX = 0 Win in Real mode }π  begin                { else check For enhanced mode }π    Regs.AX := $1600;  { Win 3.x Enhanced check }π    Intr($2F, Regs);   { Call Int 2F }π    if Regs.AL in [$00,$80,$01,$FF] then { Check returned value }π      Win3X := False   { Nope not installed }π    elseπ      Win3X := True;   { Ya it is }π  endπ  elseπ    Win3X := True;     { Return True }πend;πππFunction WinVer :Word;π{  Returns a Word containing the version of Win Running }π{  Should only be used after checking For Win installed }π{  Or value returned will be meaningless                }πbeginπ  Regs.AX := $1600;    {  Enhanced mode check }π  Intr($2F, Regs);     {  Call Int 2F         }π  WinVer := Regs.AX;   {  Return proper value }πend;πππbeginπ  ClrScr;π  if Win3X thenπ  beginπ    Writeln('Windows is Running! ');    { Display version }π    Writeln('Version Running is : ', Lo(WinVer), '.', Hi(WinVer));π  endπ  elseπ    Writeln('Windows is not Running!');πend.π                                                                                                                             2      05-28-9314:10ALL                      GREGORY P. SMITH         OS2CHECK.PAS             IMPORT              34     Kx»π {πAuthor : GREGORY P. SMITHππ> Is there any way to detect OS/2 (in a Dos box) sessions and Windowsπ> Sessions? I'd like to throw in support For these multitaskers so I canπ> run an idlekey Program.ππActual code is always the best example For me..  Look at this Unit (and useπit, I think you'll like it).  Check With someone else if you want toπspecifically detect winslows.  This Unit will, however, give up time to anyπmultitasker.π}ππ(* Public Domain Unit by Gregory P. Smith, No Rights Reserved *)π(* ...  This also means no guarantees  ... *)ππUnit OS_Test; { DESQview, OS/2, & 386 v86 machine Interfaces }ππ{$X+,S-,R-,F-,O-,D-,G-} { extended syntax, nothing else }ππInterfaceππConstπ  In_DV  : Boolean = False; { are we in DESQview? }π  In_VM  : Boolean = False; { are we in a 386+ virtual machine? }π  In_OS2 : Boolean = False; { are we in OS/2? }ππFunction  OS2_GetVersion: Word; { Get OS/2 version # }πFunction  DV_GetVersion: Word; { update In_DV and get version # }πFunction  DV_Get_Video_Buffer(vseg:Word): Word; { get the alt video buffer }πProcedure DV_Pause; { give up time slice }πProcedure MT_Pause; Inline($cd/$28); { give up time in most multitaskers }πProcedure KillTime; { Release time in any situation }πProcedure DV_begin_Critical; { don't slice away }π  Inline($b8/$1b/$10/$cd/$15);πProcedure DV_end_Critical; { allow slicing again }π  Inline($b8/$1c/$10/$cd/$15);πProcedure DV_Sound(freq,dur:Integer); { Create a Sound in the Bkg }ππImplementationππFunction OS2_GetVersion: Word; Assembler;πAsmπ  MOV    AH, 30h  { Dos Get Version Call }π  INT    21h      { AL = major version * 10, AH = minor version }π  MOV    BH, AH   { save minor version }π  xor    AH, AHπ  MOV    CL, 10π  div    CL       { divide by 10 to get the major version }π  MOV    AH, BH   { restore minor version }π  XCHG   AH, AL   { AH = major, AL = minor }πend;ππFunction DV_GetVersion: Word; Assembler;πAsmπ  MOV    CX,'DE'     { CX+DX to 'DESQ' (invalid date) }π  MOV    DX,'SQ'π  MOV    AX,02B01H   { Dos' set date funct. }π  INT    21H         { call Dos }π  CMP    AL,0FFH     { Was it invalid? }π  JE     @No_dv      { yep, no dv }π  MOV    AX,BX       { AH=major AL=minor }π  MOV    In_DV,1     { Set In_DV flag }π  JMP    @DvGv_x     { other routines }π @No_dv:π  xor    AX,AX       { Return 0 or no DV }π @DvGv_x:πend; { DV_GetVersion }ππFunction DV_Get_Video_Buffer(vseg:Word): Word; Assembler;πAsm                      { Modified by Scott Samet April 1992 }π  CALL   DV_GetVersion   { Returns AX=0 if not in DV }π  MOV    ES,vseg         { Put current segment into ES }π  TEST   AX,AX           { In DV? }π  JZ     @DVGVB_X        { Jump if not }π  MOV    AH,0FEH         { DV's get video buffer Function }π  INT    10H             { Returns ES:DI of alt buffer }π @DVGVB_X:π  MOV    AX,ES           { Return video buffer }πend; { DV_Get_Video_Buffer }ππProcedure DV_Pause;πbeginπ  if In_DV thenπ  Asmπ    MOV AX, 1000h    { pause Function }π    INT 15hπ  end;πend; { DV_Pause }ππProcedure KillTime;πbeginπ  if In_VM thenπ  Asmπ    MOV AX, 1680h    { give up VM time slice }π    INT 2Fhπ  endπ  elseπ  if In_DV thenπ  Asmπ    MOV AX, 1000h    { DV pause call }π    INT 15hπ  endπ  elseπ    MT_Pause;      { Dos Idle call }πend;ππ(* Procedure DV_begin_Critical; Assembler;πAsmπ  MOV AX,$101B       { DV begin critical Function }π  INT 15hπend; { DV_begin_Critical }ππProcedure DV_end_Critical; Assembler;πAsmπ  MOV AX,$101C       { DV end critical Function }π  INT 15hπend; { DV_end_Critical }  *)ππProcedure DV_Sound(freq,dur:Integer); Assembler; { Sound a tone }πAsmπ  MOV   AX,1019Hπ  MOV   BX,freq  { frequency above 20 Hz }π  MOV   CX,dur   { duration in clock ticks }π  INT   15Hπend;ππ{ ** -- initalization -- ** }ππbeginπ  DV_GetVersion; { discard answer.  Just update In_DV }π  Asmπ    MOV AX, 1680hπ    INT 2Fh          { Gives up time slice in most 386+ virtual machines }π    not AL           { AL = 00h if supported, remains 80h if not }π    MOV CL, 7π    SHR AL, CL       { move bit 7 to bit 0 For a Boolean }π    MOV In_VM, AL    { update the flag }π  end;π  In_OS2 := (OS2_GetVersion >= $0100); { version 1.0 or greater }πend.ππ                                                                             3      05-28-9314:10ALL                      SWAG SUPPORT TEAM        WINCHECK.PAS             IMPORT              6      Kxτn {π>How can I check from my Dos Program that Windows are running inπ>the background?π}ππUnit Chk4Win;ππInterfaceππTypeπ  Win3ModeType = (NoWin, RealStd, Enhanced);ππFunction CheckForWin3 : Win3ModeType;ππImplementationππFunction CheckForWin3 : Win3ModeType;  Assembler;πAsmπ  mov    ax,1600hπ  int    2Fhπ  cmp    al,1π  jbe    @@CheckRealStdπ  cmp    al,80hπ  jae    @@CheckRealStdπ  mov    al,2π  jmp    @@ExitPointπ@@CheckRealStd:π  mov    ax,4680hπ  int    2Fhπ  or     ax,axπ  jnz    @@notWinπ  mov    al,1π  jmp    @@ExitPointπ@@notWin:π  xor    al,alπ@@ExitPoint:πend;ππend.π                                                           4      05-28-9314:10ALL                      SWAG SUPPORT TEAM        WINICONS.PAS             IMPORT              24     Kx£ {π I am writing a Dos based Program in Turbo Pascal 6.0 that Uses aπ GUI Interface. My problem is that I would like to be able to importπ Windows or OS/2 icons to use instead of making my own. Does anyoneπ know the File Format For either of these Files or better yet haveπ source code For displaying them. Any help would be greatly appreciated.ππThe following code is a Unit I wrote to handle Windows icon Files. Iπdon't have the code yet For OS/2 icon Files, although I believe they areπquite similar. As Far as displaying the icons, just pass a Pointerπto the icon to your Graphics routines and let them decode and displayπthe structures. You should also be able to use a subset of theπstructures to decode icons embedded in Windows .EXE Files.ππAt offset $24 in the "new executable" header For Windows and OS/2 .EXEπFiles is a Word Variable that specifies an additional offset to theπresource table.π}ππUnit WinIcons;ππ(********************************)Interface(*********************************)ππTypeπ  tBMPInfoHdr = Recordπ    vHdrSize,                 (* Always 40 For Windows icons *)π    vPixelWidth,π    vPixelHeight   : LongInt;π    vColorPlanes,             (* Should always be 1 *)π    vBitCount      : Word;π    vCompression,π    vImageSize,π    vXPelsPerMeter,π    vYPelsPerMeter,π    vClrUsed,π    vClrImportant  : LongInt;π  end;ππ  tWinIconColor = Recordπ    vBlue,π    vGreen,π    vRed,π    vUnused : Byte;π  end;ππ  tRGBTable = Array[0..15] of tWinIconColor;ππ  txorMask = Array[0..511] of Byte;ππ  tandMask = Array[0..127] of Byte;ππ  tWinIcon = Record                (* The icon itself *)π    vBMPInfoHdr : tBMPInfoHdr;π    vRGBTable   : tRGBTable;π    vxorMask    : txorMask;π    vandMask    : tandMask;π  end;ππ  tWinIconDirEntry = Record        (* Icon File directory entry.  *)π    vIconWidth,                    (* 1 For each icon in the File *)π    vIconHeight,π    vColorCount,π    vReserved    : Byte;π    vPlanes,π    vBitCount    : Word;π    vBytesInRes,π    vImageoffset : LongInt;π  end;ππ  (* The following two Arrays have to be sized at run-time as they can  *)π  (* hold up to 65,535 entries. The actual number of entries is set by  *)π  (* vIdCount. When reading an icon File, read in the vIdCount Variable *)π  (* and then use GetMem to allocate the correct amount of heap.        *)ππ  tDirListPtr = ^tDirList;π  tDirList    = Array[1..1] of tWinIconDirEntry;ππ  tIconListPtr = ^tIconList;π  tIconList    = Array[1..1] of tWinIcon;ππ  tWinIconFileRec = Recordπ    vIdReserved,π    vIdType,π    vIdCount     : Word;π    vDirList     : tDirListPtr;π    vIconList    : tIconListPtr;π  end;πππ  tWinIconFile = File of tWinIconFileRec;ππVarπ  vWinIconFile : tWinIconFile; (* Hook to access icon Files *)ππ(******************************)Implementation(******************************)ππend.π                                                                                                                      5      08-27-9321:43ALL                      MICHAEL VINCZE           Window painting          IMPORT              24     Kx╔\ {πmichael a vinczeππBelow I have re-written your Paint method.  It is commented where I made theπchanges. Get in touch with me if you have any questions.π}ππprocedure TNumConWindow.Paint(PaintDC : HDC; var PaintInfo : TPaintStruct);πvarπ  X, Y    : Integer;π  WRect   : TRect;π  DeltaX,π  DeltaY,π  XSize,π  YSize   : Integer;π  Perc    : Real;π  Str     : string;π  PC      : PChar;π  PCP     : Integer;π  SaveBK  : LongInt;π  ThePen  : HPen;π  TheBrush: HBrush;π  TheRect : TRect;ππconstπ  CP       = 1;π  NumLic   = 64;π  MaxCount = 6;π  Count    : array [1..MaxCount] of Integer = (2, 4, 8, 16, 32, 64);π  OutStr   : string = 'Hello Allen E. Stoner ';ππbeginπ  GetClientRect(HWindow, WRect);π  XSize := WRect.Right - WRect.Left;π  YSize := WRect.Bottom - WRect.Top - 40;ππ  Perc   := YSize / (NumLic * 1.05);π  DeltaY := Round(Perc * 10);ππ  { Draw fat line at bottom of graph.  The color is the system default. }π  MoveTo(PaintDC, 0, YSize);π  LineTo(PaintDC, XSize, YSize);π  MoveTo(PaintDC, 0, YSize + 1);π  LineTo(PaintDC, XSize, YSize + 1);π  MoveTo(PaintDC, 0, YSize + 2);π  LineTo(PaintDC, XSize, YSize + 2);ππ  { Draw horizontal lines.  The color is the system default. }π  Y := YSize;π  while Y > 0 doπ  beginπ    Rectangle(PaintDC, 0, Y, XSize, Y - DeltaY);π    Y := Y - (DeltaY * 2);π  end;ππ  { Fill in rectangle at bottom yellow.  This is the same size as WRectπ    except the top is at YSize + 3. }π  TheBrush := CreateSolidBrush(RGB($FF, $FF, $00));π  CopyRect(TheRect, WRect);π  TheRect.Top := YSize + 3;π  FillRect(PaintDC, TheRect, TheBrush);ππ  { Draw vertical lines red. If you wanted to, you could draw rectanglesπ    instead of lines. Notice how I've selected a width of 4 for ThePen.π    You could also have a different color for each "bar" by having X indexπ    into an array of TColorRefs and changing ThePen for each new value of X.}π  ThePen := CreatePen(PS_SOLID, 4, RGB($FF, $00, $00));π  SelectObject(PaintDC, ThePen);π  for X := 1 to MaxCount doπ  beginπ    MoveTo(PaintDC, X * 10, YSize);π    LineTo(PaintDC, X * 10, Round(YSize - (Count[X] * Perc)));π  end;ππ  if CP = 1 thenπ    PCP := 300π  elseπ    PCP := CP - 1;π  PC := @OutStr[1];ππ  { Set the color of the text.  Note GetSysColor is used merely as an example.π    Don't forget that the background of the text must also be colored.  Thisπ    color should be yellow, as in TheBrush, however a different color wasπ    selected for illustration purposes.  Alternatively SetBkMode() couldπ    be used }π  SetTextColor(PaintDC, GetSysColor(COLOR_HIGHLIGHT));π  SetBkColor(PaintDC, RGB($00, $FF, $FF));π  { Use SetBkMode () instead of SetBkColor () to see what happens.π    SetBkMode (PaintDC, TRANSPARENT); }ππ  TextOut(PaintDC, 10, YSize+15, PC, Length(OutStr)-1);ππ  { Don't forget to delete the selected objects. }π  DeleteObject(ThePen);π  DeleteObject(TheBrush);πend;π                                                                                   6      08-27-9322:10ALL                      MICHAEL VINCZE           Window Fonts             IMPORT              19     Kxé∞ {πMICHAEL A VINCZEππBelow is an example I whipped up that shows how to vary the font in an edit control.πThe method can be extended to other controls as well.  Two methods are presented:πusing a stock object to get a fixed font, and using a created font.ππI have not figured out how to get the colors to change though.π}ππprogram Font_Ctl;ππusesπ  Win31, WinTypes, WinProcs,π  Objects, OWindows, ODialogs;ππconstπ  ApplicationName : PChar = 'Font_Ctl';ππ  id_Edit1 = 201;π  id_Edit2 = 202;π  id_Edit3 = 203;ππtypeπ  TFont_CtlApplication = object (TApplication)π    procedure InitMainWindow; virtual;π  end;ππ  PFont_CtlWindow = ^TFont_CtlWindow;π  TFont_CtlWindow = object (TWindow)π    EditBox : PEdit;π    VarFont : HFont;π    FixFont : THandle;ππ    constructor Init(AParent : PWindowsObject; ATitle : PChar);π    procedure   SetupWindow; virtual;π    destructor  Done; virtual;π  end;ππprocedure TFont_CtlApplication.InitMainWindow;πbeginπ  MainWindow := New(PFont_CtlWindow, Init(nil, ApplicationName));πend;ππconstructor TFont_CtlWindow.Init(AParent : PWindowsObject; ATitle : PChar);πbeginπ  inherited Init(AParent, ATitle);π    EditBox := New(PEdit, Init (@Self, id_Edit1, 'EditBox 1 (normal)',π                10, 10, 500, 30, $FF, False));π    EditBox := New(PEdit, Init (@Self, id_Edit2, 'EditBox 2 (fixed font)',π                10, 50, 500, 30, $FF, False));π    EditBox := New(PEdit, Init (@Self, id_Edit3, 'EditBox 3 (variable font)',π                10, 90, 500, 30, $FF, False));π    FixFont := GetStockObject (System_Fixed_Font);ππ    VarFont := CreateFont(20, 20, 0, 0, fw_DontCare, 0, 0, 0,π                          Default_CharSet, Out_Default_Precis,π                          Clip_Default_Precis, Default_Quality,π                          Variable_Pitch or ff_DontCare, nil);πend;ππdestructor TFont_CtlWindow.Done;πbeginπ  inherited Done;π  DeleteObject(VarFont);πend;ππprocedure TFont_CtlWindow.SetupWindow;πbeginπ  inherited SetupWindow;π  SendMessage(GetDlgItem (HWindow, id_Edit2), wm_SetFont, FixFont, 1);π  SendMessage(GetDlgItem (HWindow, id_Edit3), wm_SetFont, VarFont, 1);πend;ππvarπ  Application : TFont_CtlApplication;ππbeginπ  Application.Init (ApplicationName);π  Application.Run;π  Application.Done;πend.π                                                            7      08-27-9322:10ALL                      SCOTT SAMET              "About" box in Windows   IMPORT              15     Kx∞ {πSCOTT SAMETππ> I have a program that is always an icon, but I want to add an "about"π> command to it, to display a dialog box with info on the author andπ> the program. Anyone know how to do this or where info on it can be found?ππAll system menu commands, even those you add, are returned as wm_SysCommandπmessages.  You need to check wParam to see if it's one of yours, and if not,πpass it to DefWndProc.π}ππUsesπ  OWindows, WinProcs, WinTypes;ππConstπ  cm_About = 100;ππTypeπ  TMyApp = Object(TApplication)π    Procedure InitMainWindow; Virtual;π  end;ππ  PMyWin = ^TMyWin;π  TMyWin = Object(TWindow)π    Procedure SetupWindow; Virtual;π    Procedure wmSysCommand(Var Msg : TMessage);π      virtual wm_First + wm_SysCommand;π    Procedure wmQueryOpen(Var Msg : TMessage);π      virtual wm_First + wm_QueryOpen;π  end;ππProcedure TMyApp.InitMainWindow;πBeginπ  MainWindow := New(PMyWin, Init (Nil, 'Test Window'));π  { This gives the window a system menu with Move, Switch and Close }π  PWindow(MainWindow)^.Attr.Style := ws_Overlapped or ws_Sysmenu;πend;ππProcedure TMyWin.SetupWindow;πVarπ  SysMenu: hMenu;πBeginπ  SysMenu := GetSystemMenu(hWindow, False);π  AppendMenu(SysMenu, mf_Separator, 0, Nil);π  AppendMenu(SysMenu, mf_String, cm_About, '&About');πend;ππProcedure TMyWin.wmQueryOpen(Var Msg : TMessage);πBeginπ  { This keeps the window an icon at all times }π  Msg.Result := 0;πend;ππProcedure TMyWin.wmSysCommand(Var Msg : TMessage);πBeginπ  Case Msg.wParam ofπ    cm_About :π      MessageBox(hWindow, 'About Text', 'About Box', mb_ok)π    Elseπ      DefWndProc (Msg);π  end;πend;ππVarπ  App:  TMyApp;πBeginπ  CmdShow := sw_ShowMinimized;π  App.Init ('Test');π  App.Run;π  App.Done;πend.π                                                                                         8      11-02-9305:32ALL                      SWAG SUPPORT TEAM        DOS in OS2               IMPORT              10     Kxtq {πTREVOR@wordperfect.comππBelow is a dinky program to start a os/2 program from a os/2 dos window.πIt's pretty ugly right now, but it works fairly well.  I dug this up byπdebugging VIEW.EXE, so there may be errors or omissions.  Anyone can haveπthis, feel free to mutilate it in any way you wish.π}ππprogram dosstart;ππvarπ  buf   : array[0..8] of PChar;π  dir,π  title,π  fname,π  opts  : string;π  i     : integer;πbeginπ  if paramcount > 0 thenπ  beginπ    fillchar(buf, sizeof(buf), 0);π    buf[0] := ptr(0, $20);π    title  := 'Blah blah: ' + paramstr(1) + #0;   { window title }π    buf[2] := @title[1];π    fname  := paramstr(1);π    fname  := fname + #0;π    buf[3] := @fname[1];π    if paramcount > 1 thenπ    beginπ      opts := '';π      for i := 2 to paramcount doπ        opts := opts + paramstr(i);π      opts := opts + #0;π      buf[4] := @opts[1];π    end;π    asmπ      mov ax, 6400hπ      mov bx, 0025hπ      mov cx, 636chπ      mov si, offset bufπ      int 21hπ    end;π  endπ  elseπ  beginπ    writeln('USAGE:');π    writeln('   DOSSTART.EXE OS2PROG [OS2PROG_OPTIONS]');π    writeln;π  end;πend.ππ                                   9      11-21-9309:25ALL                      ELM MORROW               Load Bitmaps             IMPORT              25     Kx╞ {πFrom: ELM MORROWπSubj: LOADBMPS.PASπ}ππ{$R-}ππunit LoadBMPs;ππinterfaceππuses WinProcs, WinTypes, Strings, WinDos;ππfunction LoadBMP(Name: PChar; Window: hWnd; var DibPal: Word;π  var Width, Height: LongInt): hBitMap;ππimplementationππfunction CreateBIPalette(BI: PBitMapInfoHeader): HPalette;πtypeπ  ARGBQuad = Array[1..5000] of TRGBQuad;πvarπ  RGB: ^ARGBQuad;π  NumColors: Word;π  Pal: PLogPalette;π  hPal: hPalette;π  I: Integer;πbeginπ  CreateBiPalette := 0;π  RGB := Ptr(Seg(BI^), Ofs(BI^)+BI^.biSize);π  if BI^.biBitCount<24 thenπ  beginπ    NumColors:= 1 shl BI^.biBitCount;π    if NumColors<>0 thenπ    beginπ      GetMem(Pal, SizeOf(PLogPalette)+NumColors*SizeOf(TPaletteEntry));π      Pal^.palNumEntries := NumColors;π      Pal^.palVersion := $300;π      for I := 0 to NumColors-1 doπ      beginπ        Pal^.palPalEntry[I].peRed := RGB^[I].rgbRed;π        Pal^.palPalEntry[I].peGreen := RGB^[I].rgbGreen;π        Pal^.palPalEntry[I].peBlue := RGB^[I].rgbBlue;π        Pal^.palPalEntry[I].peFlags := 0;π      end;π      hPal := CreatePalette(Pal^);π      FreeMem(Pal, SizeOf(PLogPalette) + NumColors * SizeOf(TPaletteEntry));π      CreateBiPalette := hPal;π    end;π  end;πend;ππfunction LoadBMP(Name: PChar; Window: hWnd; var DibPal: Word;π  var Width, Height: LongInt): hBitMap;πvarπ  BitMapFileHeader: TBitMapFileHeader;π  DibSize, ReadSize, ColorTableSize, TempReadSize: LongInt;π  DIB: PBitMapInfoHeader;π  TempDib: Pointer;π  Bits: Pointer;π  F: File;π  BitMap: hBitMap;π  Handle: Word;π  DC: hDC;π  OldCursor: HCursor;πbeginπ  Assign(F, Name);π  {$I-}Reset(F, 1);{$I+}π  if IOResult<>0 thenπ  beginπ    LoadBMP := 0;π    Exit;π  end;π  OldCursor := SetCursor(LoadCursor(0, IDC_Wait));π  BlockRead(F, BitMapFileHeader, SizeOf(BitMapFileHeader));π  DibSize := BitMapFileHeader.bfSize - BitMapFileHeader.bfOffBits;π  ReadSize := LongInt(BitMapFileHeader.bfSize) - SizeOf(BitMapFileHeader);π  Handle := GlobalAlloc(GMem_Moveable, ReadSize);π  DIB := GlobalLock(Handle);π  TempReadSize := ReadSize;π  TempDib := Dib;π  while TempReadSize > 0 doπ  beginπ    if TempReadSize > $8000 thenπ    beginπ      BlockRead(F, TempDIB^, $8000);π      if Ofs(TempDib^) = $8000 thenπ         TempDib := Ptr(Seg(TempDib^) + 8, 0)π      elseπ         TempDib := Ptr(Seg(TempDib^), $8000);π    endπ    elseπ      BlockRead(F, TempDIB^, TempReadSize);π    Dec(TempReadSize, $8000);π  end;π  if DIB^.biBitCount = 24 thenπ    ColorTableSize := 0π  elseπ    ColorTableSize := LongInt(1) shl DIB^.biBitCount * SizeOf(TRGBQuad);π  Bits := Ptr(Seg(DIB^), Ofs(DIB^) + DIB^.biSize + ColorTableSize);π  Close(F);π  DC := GetDC(Window);π  DibPal := CreateBIPalette(DIB);π  if DibPal = 0 thenπ  beginπ    SelectPalette(DC, DibPal, false);π    RealizePalette(DC);π  end;π  BitMap := CreateDIBitMap(DC, DIB^, cbm_Init, Bits, PBitMapInfo(Dib)^,π    dib_RGB_Colors);π  Height := DIB^.biHeight;π  Width := DIB^.biWidth;π  ReleaseDC(Window, DC);π  GlobalUnLock(Handle);π  GlobalFree(Handle);π  LoadBMP := BitMap;π  SetCursor(OldCursor);πend;ππend.π                                             10     11-26-9316:55ALL                      BARRY NAUJOK             View Windows BMP Files   IMPORT              199    Kx ╓ {π-----------------------------------------------------------------------------πProgram BMPView;  { by Barry Naujok, 1993, written in TP7 }π    { This information was completely derived on my own (ALL of it). }π    { If there are any errors or omisions, please let me know at ... }π    {          a1357665@cfs01.cc.monash.edu.au                       }π    { Currently only supports 3-256 colours (not monochrome or true colour) }π    { My opinion: As can be seen from decoding a BitMaP, I truly believe }π    {    that Microsoft is a bit backwards! :) (other opinions welcome) }ππUses VESA,Crt,Dos,Strings;ππConst bufsize=32000; { my optimal buffer size, could be bigger for other drives }π             { Has to be even for the RLE decompression }πType THeader=Recordπ       ID    : Word;     { 'BM' for a Windows BitMaP }π       FSize : LongInt;  { Size of file }π       Ver   : LongInt;  { BMP version (?), currently 0 }π       Image : LongInt;  { Offset of image into file }π       Misc  : LongInt;  { Unknown, appears to be 40 for all files }π       Width : LongInt;  { Width of image }π       Height: LongInt;  { Height of image }π       Num   : Word;     { Not sure, possibly number of images or planes (1) }π       Bits  : Word;     { Number of bits per pixel }π       Comp  : LongInt;  { Type of compression, 0 for uncompressed, 1,2 for RLE }π       ISize : LongInt;  { Size of image in bytes }π       XRes  : LongInt;  { X dots per metre (not inches! for US, unbelievable!) }π       YRes  : LongInt;  { Y dots per metre }π       PSize : LongInt;  { Palette size (number of colours) if not zero }π       Res   : LongInt;  { Probably reserved, currently 0 }π     End;  { 54 bytes }ππ     PByte = ^Byte;ππ     TPalette = Recordπ       b,g,r,x : Byte;   { BMP uses a fourth byte for the palette, not used }π     End;ππVar  fl     : File;π     header : THeader;π     buffer : PByte;ππProcedure BlankPalette;πVar pal : Array[0..767] Of Byte;π    r   : Registers;πBeginπ  FillChar(pal,768,0);π  r.ax:=$1012;π  r.bx:=0;π  r.cx:=256;π  r.dx:=Ofs(pal);π  r.es:=Seg(pal);π  Intr($10,r);πEnd;ππProcedure SetPalette;πConst Pal16:Array[0..15]Of Byte=(0,1,2,3,4,5,20,7,56,57,58,59,60,61,62,63);πVar palette : TPalette;  { ^ Actual BIOS palette numbers for 16 colour modes }π    BIOSpal : Array[0..767] Of Byte;π    i       : Byte;π    r       : Registers;πBeginπ  For i:=0 To header.PSize-1 Do Beginπ    BlockRead(fl,palette,4);π    If header.PSize>16 Then Beginπ      BIOSpal[i*3]:=palette.r Shr 2;π      BIOSpal[i*3+1]:=palette.g Shr 2;π      BIOSpal[i*3+2]:=palette.b Shr 2;π    End Else Beginπ      BIOSpal[Pal16[i]*3]:=palette.r Shr 2;π      BIOSpal[Pal16[i]*3+1]:=palette.g Shr 2;π      BIOSpal[Pal16[i]*3+2]:=palette.b Shr 2;π    End;π  End;π  r.ax:=$1012;π  r.bx:=0;π  r.cx:=256;π  r.dx:=Ofs(BIOSpal);π  r.es:=Seg(BIOSpal);π  Intr($10,r);πEnd;ππProcedure ShowImage256(name:PChar); Assembler;πVar dseg,width,height,bytes,rows,bank,handle,cp:Word;πAsmπ    Mov     dseg,dsπ    Mov     ax,header.Comp.Word[0]π    Mov     cp,axπ    Mov     ax,header.Width.Word[0]π    Test    ax,1π    Jz      @0Iπ    Inc     ax  { image is word aligned so adjust width if needed }π  @0I:  Mov     width,axπ    Mov     ax,header.Height.Word[0]π    Mov     height,axπ    Mov     di,axπ    Dec     diπ    Mov     ax,VesaMode.Bytesπ    Mov     bytes,axπ    Mov     ax,VesaMode.Heightπ    Mov     rows,axπ    Mov     es,VesaMode.SegAππ    Mov     ax,$3D00π    Lds     dx,nameπ    Int     $21                     { Open the file for assembler }π    Mov     ds,dseg                 { Restore the data segment }π    Jc      @Exπ    Mov     handle,axππ    Mov     bx,axπ    Mov     ax,$4200π    Mov     cx,header.Image.Word[2]π    Mov     dx,header.Image.Word[0]π    Int     $21                     { Seek to image location }π    Call    @FRπ    Jmp     @0Nππ  @FR:  Push    axπ    Push    cxπ    Push    dxπ    Mov     ds,dsegπ    Mov     bx,handleπ    Mov     cx,bufsizeπ    Lds     si,bufferπ    Mov     dx,siπ    Mov     ah,$3Fπ    Int     $21π    Mov     bx,ax                   { Bytes left to read from the buffer }π    Pop     dxπ    Pop     cxπ    Pop     axπ    RetNππ  @0N:  Mov     ax,bytesπ    Mul     diπ    Mov     di,axπ    Mov     bank,dxπ    Call    @B1                     { Set the last line & bank }π    Mov     dx,widthππ    Cmp     cp,0π    Je      @0Sππ    { RLE bitmap }π  @1S:  Xor     dx,dx                   { Set DX as the width count }π  @10:  Xor     ah,ah                   { Clear upper byte }π    Lodsb                           { Get "index" byte }π    Dec     bx                      { Decrement buffer count }π    Jnz     @11                     { Jump if not empty }π    Call    @FR                     { Reload buffer }π  @11:  Or      al,alπ    Jz      @14                     { Jump if following is a string }π    { Repeat byte }π    Mov     cx,ax                   { else "index" is a repeat count }π    Add     dx,cxπ    Lodsb                           { Load data to repeat "index" times }π    Dec     bxπ    Jnz     @12                     { Jump if buffer isn't empty }π    Call    @FRπ  @12:  Stosb                           { Draw byte to screen }π    Or      di,di                   { Check to see if line crosses bank }π    Jnz     @13π    Inc     bank                    { Change bank if crossed }π    Call    @B1π  @13:  Loop    @12                     { Store all repeated bytes }π    Jmp     @10π    { Dump string }π  @14:  Lodsb                           { Load "count", number of bytes in the string }π    Mov     cx,axπ    Add     dx,cxπ    Dec     bxπ    Jnz     @1T                     { Update buffer count (& buffer contents) }π    Call    @FRπ  @1T:  Or      al,alπ    Jz      @20π  @15:  Movsb                           { Transfer string to screen }π    Or      di,diπ    Jnz     @16                     { bank checking }π    Inc     bankπ    Call    @B1π  @16:  Dec     bx                      { Update buffer count, etc }π    Jnz     @17π    Call    @FRπ  @17:  Loop    @15                     { Repeat for string }π    Test    al,1                    { See if there was an odd numbered count }π    Jz      @10                     { Jump if even }π    Lodsb                           { Clear extra byte, due to word alignment }π    Dec     bxπ    Jnz     @10                     { Update buffer count, etc }π    Call    @FRπ    Jmp     @10π  @20:  Sub     di,dx                   { Move screen pointer to start of line }π    Jnc     @21                     { Jump if not crossed bank }π    Dec     bank                    { Update bank if crossed }π    Call    @B1π  @21:  Sub     di,bytes                { Move to screen line above }π    Jnc     @23                     { Jump if not crossed bank }π    Dec     bank                    { Update bank if crossed }π    Call    @B1π  @23:  Dec     height                  { Update line count }π    Jnz     @1S                     { Jump to start if not end of the image }π    Jmp     @Ex                     { Exit if image drawn }ππ    { Un-compressed bitmap }π  @0S:  Mov     cx,dxπ    Mov     ax,diπ    Add     ax,cxπ    Jc      @03                     { Jump if line crosses bank }π    Cmp     bx,cxπ    Jle     @03                     { Jump if file buffer will run out }π    Sub     bx,cx                   { Update buffer counter }π    Shr     cx,1π    Jnc     @01π    Movsbπ  @01:  Rep     Movsw                   { Show line }π    Sub     di,dx                   { Go to next line (above) }π    Sub     di,bytesπ    Jnc     @02π    Dec     bank                    { See if line above is in another bank }π    Call    @B1π  @02:  Dec     heightπ    Jnz     @0Sπ    Jmp     @Exπ  @03:  Movsbπ    Or      di,diπ    Jnz     @04π    Inc     bankπ    Call    @B1π  @04:  Dec     bxπ    Jnz     @05π    Call    @FRπ  @05:  Loop    @03π    Sub     di,dxπ    Jnc     @06π    Dec     bankπ    Call    @B1π  @06:  Sub     di,bytesπ    Jnc     @07π    Dec     bankπ    Call    @B1π  @07:  Dec     heightπ    Jnz     @0Sπ    Jmp     @Exπππ    { Set bank }π  @B1:  Push    axπ    Push    dsπ    Mov     ds,dsegπ    Mov     al,vesaonπ    Or      al,alπ    Jz      @B3π    Push    bxπ    Push    dxπ    Mov     dx,bankπ    Xor     bx,bxπ    Mov     ax,64π    Mul     dxπ    Div     VesaMode.Granπ    Mov     dx,axπ    Push    dxπ    Call    VesaMode.WinFuncπ    Pop     dxπ    Inc     bxπ    Call    VesaMode.WinFuncπ    Pop     dxπ    Pop     bxπ  @B3:  Pop     dsπ    Pop     axπ    RetNπ  @Ex:  Mov     ds,dsegπ        Mov     bx,handle              { Close the file }π    Mov     ah,$3Eπ    Int     $21πEnd;ππProcedure ShowImage16(name:PChar); Assembler;πVar dseg,width,height,bytes,rows,bank,handle,cp,rc,bc:Word;πAsmπ    Mov     dseg,dsπ    Mov     ax,header.Comp.Word[0]π    Mov     cp,axπ    Mov     ax,header.Width.Word[0]π    Mov     width,axπ    Mov     ax,header.Height.Word[0]π    Mov     height,axπ    Mov     di,axπ    Dec     diπ    Mov     ax,VesaMode.Bytesπ    Mov     bytes,axπ    Mov     ax,VesaMode.Heightπ    Mov     rows,axπ    Mov     es,VesaMode.SegAππ    Mov     ax,$3D00π    Lds     dx,nameπ    Int     $21                     { Open the file for assembler }π    Mov     ds,dseg                 { Restore the data segment }π    Jc      @Exπ    Mov     handle,axππ    Mov     bx,axπ    Mov     ax,$4200π    Mov     cx,header.Image.Word[2]π    Mov     dx,header.Image.Word[0]π    Int     $21                     { Seek to image location }π    Call    @FRπ    Jmp     @0Nππ  @FR:  Push    axπ    Push    bxπ    Push    cxπ    Push    dxπ    Mov     ds,dsegπ    Mov     bx,handleπ    Mov     cx,bufsizeπ    Lds     si,bufferπ    Mov     dx,siπ    Mov     ah,$3Fπ    Int     $21π    Mov     bc,ax                   { Bytes left to read from the buffer }π    Pop     dxπ    Pop     cxπ    Pop     bxπ    Pop     axπ    RetNππ  @0N:  Mov     ax,bytesπ    Mul     diπ    Mov     di,axπ    Mov     bank,dxπ    Call    @B1                     { Set the last line & bank }π    Mov     dx,$3CEπ    Mov     ax,$205π    Out     dx,ax                   { Set Write Mode 2 }π    Mov     ax,$8008                { Initial bit mask }ππ    Cmp     cp,0π    Je      @0Sππ    { RLE bitmap }π  @1S:  Mov     rc,0π    Mov     ax,$8008π  @10:  Xor     ch,ch                   { Clear upper byte }π    Mov     cl,[si]                 { Get "index" byte }π    Inc     siπ    Dec     bc                      { Decrement buffer count }π    Jnz     @11                     { Jump if not empty }π    Call    @FR                     { Reload buffer }π  @11:  Or      cl,clπ    Jz      @14                     { Jump if following is a string }π    { Repeat byte }π    Shr     cl,1                    {   Divide the "index" by two }π    Mov     bl,[si]                 { Load data to repeat "index" times }π    Inc     siπ    Dec     bcπ    Jnz     @12                     { Jump if buffer isn't empty }π    Call    @FRπ  @12:  Rol     bl,4π    Out     dx,axπ    Mov     bh,es:[di]π    Mov     es:[di],bl              { Update screen }π    Ror     ah,1π    Jnc     @1Bπ    Inc     diπ    Jnc     @1Bπ    Inc     bank                    { Change bank if crossed }π    Call    @B1π  @1B:  Out     dx,axπ    Rol     bl,4π    Mov     bh,es:[di]π    Mov     es:[di],blπ    Ror     ah,1π    Jnc     @13π    Inc     diπ    Inc     rcπ    Jnc     @13π    Inc     bank                    { Change bank if crossed }π    Call    @B1π  @13:  Loop    @12                     { Store all repeated bytes }π    Jmp     @10π    { Dump string }π  @14:  Mov     cl,[si]                 { Load "count", number of bytes in the string }π    Inc     siπ    Dec     bcπ    Jnz     @1E                     { Update buffer count (& buffer contents) }π    Call    @FRπ  @1E:  Or      cl,clπ    Jz      @20π    Shr     cl,1                    { Divide the "count" by 2 }π    Push    cxπ  @15:  Mov     bl,[si]π    Inc     siπ    Rol     bl,4π    Out     dx,axπ    Mov     bh,es:[di]π    Mov     es:[di],blπ    Ror     ah,1π    Jnc     @1Aπ    Inc     diπ    Jnz     @1A                     { bank checking }π    Inc     bankπ    Call    @B1π  @1A:  Out     dx,axπ    Rol     bl,4π    Mov     bh,es:[di]π    Mov     es:[di],blπ    Ror     ah,1π    Jnc     @16π    Inc     diπ    Inc     rcπ    Jnz     @16π    Inc     bankπ    Call    @B1π  @16:  Dec     bc                      { Update buffer count, etc }π    Jnz     @17π    Call    @FRπ  @17:  Loop    @15                     { Repeat for string }π    Pop     cxπ    Test    cl,1                    { See if there was an odd numbered count }π    Jz      @10                     { Jump if even }π    Mov     cl,[si]                 { Clear extra byte, due to word alignment }π    Inc     siπ    Dec     bcπ    Jnz     @10                     { Update buffer count, etc }π    Call    @FRπ    Jmp     @10π  @20:  Sub     di,rc                   { Move screen pointer to start of line }π    Jnc     @21                     { Jump if not crossed bank }π    Dec     bank                    { Update bank if crossed }π    Call    @B1π  @21:  Sub     di,bytes                { Move to screen line above }π    Jnc     @22                     { Jump if not crossed bank }π    Dec     bank                    { Update bank if crossed }π    Call    @B1π  @22:  Dec     height                  { Update line count }π    Jnz     @1S                     { Jump to start if not end of the image }π    Jmp     @Ex                     { Exit if image drawn }ππ    { Un-compressed bitmap }π  @0S:  Mov     ax,widthπ    Xor     bx,bxπ    Mov     rc,ax                   { Initialize rowcount }π    Mov     ax,$8008π  @02:  Out     dx,ax                   { Update bit mask register }π    Mov     cl,[si]                 { Load a byte (2 pixels) }π    Inc     si                      { Update buffer pointer }π    Dec     bc                      { Updata buffer count }π    Jnz     @03π    Call    @FR                     { Reload buffer if necessary }π  @03:  Ror     cl,4                    { Move 1st pixel in low part of CL }π    Mov     ch,es:[di]              { Load latches }π    Mov     es:[di],cl              { Update latches }π    Ror     ah,1                    { Shift bit mask right a pixel }π    Out     dx,ax                   { Update bit mask register }π    Ror     cl,4                    { Move 2nd pixel in low part of CL }π    Mov     ch,es:[di]              { as above 3 steps }π    Mov     es:[di],cl              { ... }π    Sub     rc,2π    Jle     @04π    Ror     ah,1π    Jnc     @02π    Inc     diπ    Inc     bxπ    Jnc     @02π    Inc     bankπ    Call    @B1π    Jmp     @02π  @04:  Mov     ax,si                   { Discard extra bytes for }π    Mov     cx,4                    { LongInt alignment (?) }π    And     ax,3π    Sub     cx,axπ    And     cx,3π    Add     si,cxπ    Sub     bc,cxπ    Sub     di,bxπ    Jnc     @06π    Dec     bankπ    Call    @b1π  @06:  Sub     di,bytesπ    Jnc     @07π    Dec     bankπ    Call    @b1π  @07:  Dec     heightπ    Jnz     @0Sπ    Jmp     @Exππ    { Set bank }π  @B1:  Push    axπ    Push    dsπ    Mov     ds,dsegπ    Mov     al,vesaonπ    Or      al,alπ    Jz      @B3π    Push    bxπ    Push    dxπ    Mov     dx,bankπ    Xor     bx,bxπ    Mov     ax,64π    Mul     dxπ    Div     VesaMode.Granπ    Mov     dx,axπ    Push    dxπ    Call    VesaMode.WinFuncπ    Pop     dxπ    Inc     bxπ    Call    VesaMode.WinFuncπ    Pop     dxπ    Pop     bxπ  @B3:  Pop     dsπ    Pop     axπ    RetNπ  @Ex:  Mov     ds,dsegπ        Mov     bx,handle              { Close the file }π    Mov     ah,$3Eπ    Int     $21πEnd;πProcedure ShowBMP;πVar fn:Array[0..63]Of Char;πBeginπ  StrPCopy(fn,ParamStr(1));π  GetMem(buffer,bufsize);π  Case header.PSize Ofπ    1..16: Beginπ     Case header.Width Ofπ          0..640  : SetMode($12);π        641..800  : SetMode($102);π        801..1024 : SetMode($104);π       1025..9999 : SetMode($106);π     End;π     BlankPalette;π     ShowImage16(fn);π       End;π    17..256: Beginπ     Case header.Width Ofπ          0..320  : SetMode($13);π        321..640  : SetMode($101);π        641..800  : SetMode($103);π        801..1024 : SetMode($105);π       1025..9999 : SetMode($107);π     End;π     BlankPalette;π     ShowImage256(fn);π       End;π  End;ππ  FreeMem(buffer,bufsize);π  SetPalette;π  Sound(660);π  Delay(100);π  Sound(880);π  Delay(50);π  Sound(440);π  Delay(75);π  NoSound;ππ  ReadKey;π  SetMode(3);πEnd;ππProcedure SetPSize;πBeginπ  If header.PSize=0 Then Case header.Bits Ofπ    1 : header.PSize:=2;  { These are the only valid bits in a BMP }π    4 : header.PSize:=16;π    8 : header.PSize:=256;π    24: header.PSize:=0;  { A 24 bit image does not have a palette }π  End;πEnd;ππBeginπ  If ParamCount>0 Then Beginπ    Assign(fl,ParamStr(1));π    {$I-}π    Reset(fl,1);π    {$I+}π    If IOResult=0 Then Beginπ      BlockRead(fl,header,54);π      If header.ID=$4D42 Then Beginπ    SetPSize; { Set the PSize field in the header if not defined }π    Writeln;π    Writeln('Width  . . . . . ',header.Width,' pixels');π    Writeln('Height . . . . . ',header.Height,' pixels');π    Writeln('Bits per Pixel . ',header.Bits);π    Writeln('Palette Size . . ',header.PSize,' colours, ',header.PSize*4,' bytes');π    Write('Compression  . . type ',header.Comp);π    If header.Comp=0 Then Writeln(' (not compressed)')π      Else Writeln(' (RLE)');π    Writeln('Image Offset . . ',header.Image);π    Writeln('Image Size . . . ',header.ISize,' bytes');π    Writeln('X Resolution . . ',header.XRes,' D/m, ',header.XRes*254 Div 10000,' DPI');π    Writeln('Y Resolution . . ',header.YRes,' D/m, ',header.YRes*254 Div 10000,' DPI');π    Writeln;π    If ((header.Width<641)And(header.Height<481)And(header.PSize<17))π       Or((header.Width<321)And(header.Height<201))Or(IsVesa) Thenπ    If header.PSize>2 Then Beginπ      Writeln('Press a key to show the image');π      ReadKey;π      ShowBMP;π    End Else Writeln('Cannot display the image without VESA graphics support');π    Close(fl);π      End Else Writeln('The file is not a Windows BitMaP file');π    End Else Writeln('File not found, try again');π  End Else Writeln('Usage: BMPVIEW <filename>');πEnd.π-----------------------------------------------------------------------------πUnit VESA;ππInterfaceππType ModeList=Array[1..32] Of Word;  { List of VESA mode numbers }ππ     TVesaMode=Recordπ       Attr     : Word;         { Mode Attributes                   }π       WinA     : Byte;         { Window A attributes               }π       WinB     : Byte;         { Window B attributes               }π       Gran     : Word;         { Window granularity in K bytes     }π       WinSiz   : Word;         { Size of window in K bytes         }π       SegA     : Word;         { Segment address of window A       }π       SegB     : Word;         { Segment address of window B       }π       WinFunc  : Procedure;    { Windows positioning function      }π       Bytes    : Word;         { Number of bytes per line          }π       Width    : Word;         { Number of horizontal pixels       }π       Height   : Word;         { Number of vertical pixels         }π       CharW    : Byte;         { Width of character cell           }π       CharH    : Byte;         { Height of character cell          }π       Planes   : Byte;         { Number of memory planes           }π       Bits     : Byte;         { Number of bits per pixel          }π       nBanks   : Byte;         { Number of banks        (not used) }π       Model    : Byte;         { Memory model type                 }π       Banks    : Byte;         { Size of bank           (not used) }π       Pages    : Byte;         { Number of image pages             }π       Reserved : Byte; { The following are for 15,16,24,32 bit colour modes }π       RedMaskSize   : Byte;    { Size of Red mask in bits          }π       RedFieldPos   : Byte;    { Bit position of LSB of Red mask   }π       GreenMaskSize : Byte;    { Size of Green mask in bits        }π       GreenFieldPos : Byte;    { Bit position of LSB of Green mask }π       BlueMaskSize  : Byte;    { Size of Blue mask in bits         }π       BlueFieldPos  : Byte;    { Bit position of LSB of Blue mask  }π       RsvdMaskSize  : Byte;    { Size of Reserved mask in bits     }π       RsvdFieldPos  : Byte;    { Bit pos. of LSB of Reserved mask  }π       DirColModeInf : Byte;    { Direct Colour mode attributes     }π       Filler   : Array[0..215] Of Byte; { Not used - filler        }π     End;ππ     TVesaInfo=Recordπ       Signature    : LongInt;   { Signature - "VESA"               }π       Version      : Word;      { VESA Version number              }π       OEMName      : PChar;     { Pointer to manufacturer name     }π       Capabilities : Longint;   { Capabilities       (Not used)    }π       List         : ^ModeList; { Pointer to list of VESA modes    }π       TotalMemory  : Word;      { Number of 64k memory blocks on card }π       Filler       : Array[1..238] of Byte;π     End; { 258 byte size due to bug in the Diamond SpeedStar 24X v1.01 BIOS }πππVar  VesaMode : TVesaMode;π                { Contains all info needed for drawing on the screen }π     VesaInfo : TVesaInfo;π                { Contains info on the VESA BIOS Extensions }ππ     vesaon   : Byte;π                { Specifies whether a VESA mode is on or not      }ππFunction  IsVesa:Boolean;π          { Detects whether VESA support is present }πProcedure GetVesaInfo;π          { Get Information on VESA modes, etc }πProcedure GetVesaModeInfo(md:Word);π          { Get Information on a VESA mode (md) }πFunction  SetMode(md:Word):Boolean;π          { Sets a video mode (OEM and VESA) }πFunction  GetMode:Word;π          { Returns the current video mode }πFunction  SizeOfVideoState:Word;π          { Returns the size of the buffer needed to save the video state }πProcedure SaveVideoState(Var buf);π          { Saves the SVGA video state in the buffer }πProcedure RestoreVideoState(Var buf);π          { Restores the SVGA video state from the buffer}πProcedure SetBank(bank:Word);π          { Set the video bank to draw on }πFunction  GetBank:Word;π          { Gets the current active video bank }πProcedure SetLineLength(Var len:Word);π          { Sets the logical scan line length, returns the actual length set }πFunction  GetLineLength:Word;π          { Returns the current logical scan line length }πProcedure SetDisplayStart(pixel,line:Word);π          { Sets the first pixel and line on the display }πProcedure GetDisplayStart(Var pixel,line:Word);π          { Returns the first pixel and line on the display }ππ{---------------------------------------------------------------------------}π{-----------------------------} Implementation {----------------------------}π{---------------------------------------------------------------------------}ππUses Dos;ππVar  rp : Registers;ππFunction IsVesa:Boolean;πBeginπ  rp.ax:=$4F03;π  Intr($10,rp);π  IsVesa:=(rp.al=$4F);πEnd;ππProcedure GetVesaInfo;πBeginπ  rp.ax:=$4F00;π  rp.di:=Ofs(VesaInfo);π  rp.es:=Seg(VesaInfo);π  Intr($10,rp);πEnd;ππProcedure GetVesaModeInfo(md:Word);πBeginπ  rp.ax:=$4F01;π  rp.cx:=md;π  rp.di:=Ofs(VesaMode);π  rp.es:=Seg(VesaMode);π  Intr($10,rp);πEnd;ππFunction SetMode(md:Word):Boolean;πBeginπ  SetMode:=True; vesaon:=1;π  If md>$FF Then Beginπ    rp.bx:=md;π    rp.ax:=$4F02;π    Intr($10,rp);π    If rp.ax<>$4F Then SetMode:=False Else GetVesaModeInfo(md);π  End Else Beginπ    rp.ax:=md;π    Intr($10,rp);π    VesaMode.Gran:=64; vesaon:=0;π    VesaMode.SegA:=$A000;π    Case md Of  { OEM (standard) video modes }π      1..3,7 : Begin { Text modes }π                 VesaMode.Width:=80;  VesaMode.Height:=25;π                 If md=7 Then Beginπ                   VesaMode.Bits:=1;  VesaMode.SegA:=$B000;π                 End Else Beginπ                   VesaMode.Bits:=4;  VesaMode.SegA:=$B800;π                 End;π                 VesaMode.Bytes:=160; VesaMode.Model:=0;π               End;π      $13 : Begin  { 320 x 200 x 256 colours, VGA & MCGA }π              VesaMode.Width:=320; VesaMode.Height:=200;π              VesaMode.Bits:=8;    VesaMode.Model:=4;π              VesaMode.Bytes:=320;π            End;π      $12 : Begin  { 640 x 480 x 16 colours, VGA only }π              VesaMode.Width:=640; VesaMode.Height:=480;π              VesaMode.Bits:=4;    VesaMode.Model:=3;π              VesaMode.Bytes:=80;π            End;π      $10 : Begin  { 640 x 350 x 16 colours, VGA & EGA with 128k+ }π              VesaMode.Width:=640; VesaMode.Height:=350;π              VesaMode.Bits:=4;    VesaMode.Model:=3;π              VesaMode.Bytes:=80;π            End;π      $0E : Begin  { 640 x 200 x 16 colours, VGA & EGA }π              VesaMode.Width:=640; VesaMode.Height:=200;π              VesaMode.Bits:=4;    VesaMode.Model:=3;π              VesaMode.Bytes:=80;π            End;π      $0D : Begin  { 320 x 200 x 16 colours, VGA & EGA }π              VesaMode.Width:=320; VesaMode.Height:=200;π              VesaMode.Bits:=4;    VesaMode.Model:=3;π              VesaMode.Bytes:=40;π            End;π      Else SetMode:=False;π    End;π  End;πEnd;ππFunction GetMode:Word;πBeginπ  rp.ax:=$4F03;π  Intr($10,rp);π  GetMode:=rp.bx;πEnd;ππFunction SizeOfVideoState:Word;πBegin  { Will save/restore all video states }π  rp.ax:=$4F04;π  rp.dl:=0;π  rp.cx:=$0F;  { hardware, BIOS, DAC & SVGA states }π  Intr($10,rp);π  SizeOfVideoState:=rp.bx;πEnd;ππProcedure SaveVideoState(Var buf);πBeginπ  rp.ax:=$4F04;π  rp.dl:=1;π  rp.cx:=$0F;π  rp.es:=Seg(buf);π  rp.bx:=Ofs(buf);π  Intr($10,rp);πEnd;ππProcedure RestoreVideoState(Var buf);πBeginπ  rp.ax:=$4F04;π  rp.dl:=2;π  rp.cx:=$0F;π  rp.es:=Seg(buf);π  rp.bx:=Ofs(buf);π  Intr($10,rp);πEnd;ππProcedure SetBank(bank:Word);πVar winnum:Word;πBeginπ  winnum:=bank*64 Div VesaMode.Gran;π  rp.ax:=$4F05;π  rp.bx:=0;π  rp.dx:=winnum;π  Intr($10,rp);π  rp.ax:=$4F05;π  rp.bx:=1;π  rp.dx:=winnum;π  Intr($10,rp);πEnd;ππFunction GetBank:Word;πBeginπ  rp.ax:=$4F05;π  rp.bx:=$100;π  Intr($10,rp);π  GetBank:=rp.dx;πEnd;ππProcedure SetLineLength(Var len:Word);πBeginπ  rp.ax:=$4F06;π  rp.bl:=0;π  rp.cx:=len;π  Intr($10,rp); { dx:=maximum number of scan lines }π  len:=rp.cx;πEnd;ππFunction GetLineLength:Word;πBeginπ  rp.ax:=$4F06;π  rp.bl:=1;π  Intr($10,rp); { dx:=maximum number of scan lines }π  GetLineLength:=rp.cx;πEnd;ππProcedure SetDisplayStart(pixel,line:Word);πBeginπ  rp.ax:=$4F07;π  rp.bx:=0;π  rp.cx:=pixel;π  rp.dx:=line;π  Intr($10,rp);πEnd;ππProcedure GetDisplayStart(Var pixel,line:Word);πBeginπ  rp.ax:=$4F07;π  rp.bx:=1;π  Intr($10,rp);π  pixel:=rp.cx;π  line:=rp.dx;πEnd;ππEnd.π    11     11-26-9317:03ALL                      MICHAEL VINCZE           Drag Bitmap              IMPORT              455    Kxű π{ PURPOSE  :  Demonstrate how to smoothly drag a bitmap across an application.ππ  AUTHOR   :  Michael Vincze (mav@asd470.dseg.ti.com)ππ  REFERENCE:  Microsoft vendor note 4-10.zip (ftp.uu.netπ              /vendor/microsoft/developer-network)ππ  DATE     :  07/25/93π}ππprogram DragBmp;ππusesπ  DragUnit,π  DragBmp_,π  WinTypes,π  WinProcs,π  OWindows,π  ODialogs;ππ{$R DragBmp }ππconstπ  ApplicationName: PChar = 'Bitmap Drag';ππtypeπ  TDragBmpApplication = object (TApplication)π    procedure InitMainWindow; virtual;π    end;ππ  PDragBmpWindow = ^TDragBmpWindow;π  TDragBmpWindow = object (TWindow)π    bImageDrawn: boolean; { has the image been drawn?     }π    bSelected  : boolean; { has the image been selected?  }π    hbmImg     : HBITMAP; { handles to image and backdrop }π    hbmbk      : HBITMAP;ππ    constructor Init (AParent: PWindowsObject; ATitle: PChar);π    procedure   SetupWindow; virtual;π    destructor  Done; virtual;π    procedure   GetWindowClass (var AWndClass: TWndClass); virtual;ππ    procedure   WMLButtonDown    (var Msg: TMessage); virtual wm_First + wm_LButtonDown;π    procedure   WMMouseMove      (var Msg: TMessage); virtual wm_First + wm_MouseMove;π    procedure   WMLButtonUp      (var Msg: TMessage); virtual wm_First + wm_LButtonUp;π    procedure   WMPaint          (var Msg: TMessage); virtual wm_First + wm_Paint;ππ    procedure   CMDrawBmp        (var Msg: TMessage); virtual cm_First + cm_DrawBmp;π    procedure   CMAbout          (var Msg: TMessage); virtual cm_First + cm_About;π    end;ππprocedure TDragBmpApplication.InitMainWindow;πbeginπMainWindow := New (PDragBmpWindow, Init (nil, ApplicationName));πend;ππconstructor TDragBmpWindow.Init (AParent: PWindowsObject; ATitle: PChar);πbeginπinherited Init (AParent, ATitle);πAttr.Menu   := LoadMenu   (hInstance, 'Main');πhbmImg      := LoadBitmap (hInstance, 'Object');πhbmBk       := LoadBitmap (hInstance, 'BackGround');πbImageDrawn := False;πbSelected   := False;πend;ππdestructor TDragBmpWindow.Done;πbeginπinherited Done;πif hbmImg <> 0 thenπ  beginπ  if bImageDrawn = TRUE thenπ    DeleteImageπ  elseπ    DeleteObject (hbmImg);π  end;πif hbmBk <> 0 thenπ  DeleteObject (hbmBk);πend;ππprocedure TDragBmpWindow.GetWindowClass (var AWndClass : TWndClass);πbeginπinherited GetWindowClass (AWndClass);πAWndClass.HIcon := LoadIcon (HInstance, ApplicationName);πend;ππprocedure TDragBmpWindow.SetupWindow;πbeginπinherited SetupWindow;πend;ππprocedure  TDragBmpWindow.WMLButtonDown (var Msg: TMessage);πbeginπif bImageDrawn = TRUE thenπ  beginπ  bSelected := IsSelected (LOWORD (Msg.lParam), HIWORD(Msg.lParam));π  if bSelected = TRUE thenπ    BeginDrag (HWindow, LOWORD (Msg.lParam), HIWORD (Msg.lParam));π  end;πend;ππprocedure  TDragBmpWindow.WMMouseMove (var Msg: TMessage);πbeginπif bSelected = TRUE thenπ  Drag (HWindow, LOWORD (Msg.lParam), HIWORD (Msg.lParam));πend;ππprocedure  TDragBmpWindow.WMLButtonUp (var Msg: TMessage);πbeginπif bSelected = TRUE thenπ  beginπ  EndDrag (HWindow, LOWORD (Msg.lParam), HIWORD (Msg.lParam));π  bSelected := FALSE;π  end;πend;ππprocedure  TDragBmpWindow.WMPaint (var Msg: TMessage);πvarπ  ps: TPaintStruct;πbeginπBeginPaint (hWindow, ps);ππif hbmBk <> 0 thenπ  DrawBackdrop (ps.hdc, hbmBk);ππif bImageDrawn = TRUE thenπ  DrawImage (ps.hdc);ππEndPaint (hWindow, ps)πend;ππprocedure TDragBmpWindow.CMDrawBmp (var Msg: TMessage);πvarπ  Menu: HMenu;π  Rect : TRect;πbeginπ{ Initialize image info }πbImageDrawn := TRUE;πInitImageInfo (hWindow, hbmImg, 100, 100);ππ{ Once drawn, disable and gray this menuitem }πMenu := GetMenu (hWindow);πEnableMenuItem (Menu, cm_DrawBmp, MF_BYCOMMAND or MF_DISABLED or MF_GRAYED);πDrawMenuBar (hWindow);πend;ππprocedure TDragBmpWindow.CMAbout (var Msg: TMessage);πbeginπApplication^.ExecDialog (New (PDialog, Init (@Self, 'About')));πend;ππvarπ  Application:TDragBmpApplication;ππbeginπApplication.Init (ApplicationName);πApplication.Run;πApplication.Done;πend.ππ---------- CUT HERE ---------- DRAGUNIT.PAS ----------ππ{ ****************************************************************************π  File: DragUnit.pasππ  Purpose: Contains bitmap dragging routines.ππ  Functions:π    InitImageInfo()π    DrawImage()π    DeleteImage()π    DrawBackdrop()π    IsSelected()π    BeginDrag()π    Drag()π    EndDrag()ππ  Development Team:π    Michael Vinczeπ    Patrick Schreiberππ  Written by Vincze International.π  Adopted from Microsoft Product Support Services, Windows Developer Supportππ  COPYRIGHT:ππ    (C) Copyright Vincze International, 1993.π    (C) Copyright Microsoft Corp. 1993.  All rights reserved.ππ    You have a royalty-free right to use, modify, reproduce andπ    distribute the Sample Files (and/or any modified version) inπ    any way you find useful, provided that you agree thatπ    Vincze International and Microsoft have no warranty obligationsπ    or liability for any Sample Application Files which are modified.ππ  ****************************************************************************  }ππunit DragUnit;ππinterfaceππusesπ  WinTypes,π  WinProcs;ππ{ force C types }πtypeπ  POINT  = TPoint;π  RECT   = TRect;π  BITMAP = TBitmap;π  BOOL   = boolean;ππprocedure InitImageInfo (hWnd_: HWND; hbm: HBITMAP; nX, nY: integer);πprocedure DeleteImage;πfunction  IsSelected (nX, nY: integer): BOOL;πprocedure BeginDrag (hWnd_: HWND; nX, nY: integer);πprocedure Drag (hwnd_: HWND; nX, nY: integer);πprocedure EndDrag (hwnd_: HWND; nX, nY: integer);πprocedure DrawBackdrop (hdc_: HDC; hbm: HBITMAP);πprocedure DrawImage (hdc_: HDC);ππimplementationππ{ Image data structure }πtypeπ  IMAGE= recordπ    bmX     : integer;  { Bitmap origin           }π    bmY     : integer;  { Bitmap origin           }π    bmWidth : integer;  { Bitmap width            }π    bmHeight: integer;  { Bitmap height           }π    hbmImage: HBITMAP;  { Image's bitmap          }π    hbmBkg  : HBITMAP;  { What's behind our image }π    end;ππ{ Global variables to this unit }πvarπ  domino  : IMAGE;    { Image's info                    }π  rcClient: RECT;     { Client area bounding rectangle  }π  xPrev   : integer;  { Previous mouse position         }π  yPrev   : integer;ππ{ ****************************************************************************π  Function: InitImageInfo()ππ  Purpose:  Initialize info for our object.ππ  Parameters:π    HDC  hdc_   - Handle to window dcπ    int  nX     - X-coordinate of object originπ    int  nY     - Y-coordinate of object originππ  Returns:π    No return value.ππ  Comments:ππ  History:  Date       Author      Reasonπ            3/9/92     PES         Createdπ            7/23/93    MAV         Corrected rect_.right and rect_.bottom toπ                                   reflect the actual update rectangle.π  ****************************************************************************  }ππprocedure InitImageInfo (hWnd_: HWND; hbm: HBITMAP; nX, nY: integer);πvarπ  hdc_,             { Handles to window and memory dcs  }π  hdcMem : HDC;π  hbmNew,           { Handles to bitmaps                }π  hbmPrev: HBITMAP;π  bm     : BITMAP;  { BITMAP data structure             }π  rect_  : RECT;    { Invalid rectangle                 }πbeginπ{ Get window and memory dcs }πhdc_   := GetDC (hWnd_);πhdcMem := CreateCompatibleDC (hdc_);ππ{ Get width and height of bitmap }πGetObject (hbm, sizeof (BITMAP), @bm);ππ{ Initialize image's info and store rect for updating }πrect_.left      := nX;πrect_.top       := nY;πrect_.right     := nX + bm.bmWidth;πrect_.bottom    := nY + bm.bmHeight;πdomino.bmX      := nX;πdomino.bmY      := nY;πdomino.bmWidth  := bm.bmWidth;πdomino.bmHeight := bm.bmHeight;πdomino.hbmImage := hbm;ππ{ Create and select a new bitmap to store our background }πhbmNew  := CreateCompatibleBitmap (hdc_, bm.bmWidth, bm.bmHeight);πhbmPrev := SelectObject (hdcMem, hbmNew);ππ{ Get the background from the screen }πBitBlt (hdcMem, 0, 0, domino.bmWidth, domino.bmHeight,π        hdc_, domino.bmX, domino.bmY, SRCCOPY);ππ{ Tidy up }πSelectObject (hdcMem, hbmPrev);πDeleteDC (hdcMem);πReleaseDC (hWnd_, hdc_);ππ{ Store the new background bitmap }πdomino.hbmBkg := hbmNew;ππ{ Update client area where image is }πInvalidateRect (hWnd_, @rect_, FALSE);πUpdateWindow (hWnd_);πend;πππ{****************************************************************************π  Function: DeleteImage()ππ  Purpose:  Delete image and background bitmaps.ππ  Parameters:π    None.ππ  Returns:π    No return value.ππ  Comments:ππ  History:  Date       Author      Reasonπ            3/9/92     PES         Createdππ  **************************************************************************** }πprocedure DeleteImage;πbeginπif domino.hbmImage <> 0 then DeleteObject (domino.hbmImage);πif domino.hbmBkg   <> 0 then DeleteObject (domino.hbmBkg);πend;πππ{ ****************************************************************************π  Function: DrawImage()ππ  Purpose:  Draws image at it's current position.ππ  Parameters:π    HDC hdc_    - Handle to window dcππ  Returns:π    No return value.ππ  Comments:ππ  History:  Date       Author      Reasonπ            3/9/92     PES         Createdππ  **************************************************************************** }πprocedure DrawImage (hdc_: HDC);πvarπ  hdcMem : HDC;     { Handle to memory dc       }π  hbmPrev: HBITMAP; { Handle to previous bitmap }πbeginπ{ Create a memory dc and select our object's bitmap into it }πhdcMem  := CreateCompatibleDC (hdc_);πhbmPrev := SelectObject (hdcMem, domino.hbmImage);ππ{ BitBlt it to the screen }πBitBlt (hdc_, domino.bmX, domino.bmY, domino.bmWidth, domino.bmHeight,π        hdcMem, 0, 0, SRCCOPY);ππ{ Tidy up }πSelectObject (hdcMem, hbmPrev);πDeleteDC (hdcMem);πend;πππ{ ****************************************************************************π  Function: DrawBackdrop()ππ  Purpose:  Draws the backdrop bitmap so we know this bitmap draggingπ            technique really works for any background.ππ  Parameters:π    HDC hdc_    - Handle to window dcπ    HBITMAP hbm - Handle to backdrop bitmapππ  Returns:π    No return value.ππ  Comments:ππ  History:  Date       Author      Reasonπ            3/9/92     PES         Createdππ  **************************************************************************** }πprocedure DrawBackdrop (hdc_: HDC; hbm: HBITMAP);πvarπ  hdcMem : HDC;     { Handle to memry dc        }π  hbmPrev: HBITMAP; { Handle to previous bitmap }π  bm     : BITMAP;  { BITMAP data structure     }πbeginπ{ Get dimensions of backdrop bitmap }πGetObject (hbm, sizeof (BITMAP), @bm);ππ{ Create a memory dc and select our backdrop's bitmap into it }πhdcMem  := CreateCompatibleDC (hdc_);πhbmPrev := SelectObject (hdcMem, hbm);ππ{ BitBlt it to the upper-left part of client area }πBitBlt (hdc_, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);ππ{ Tidy up }πSelectObject (hdcMem, hbmPrev);πDeleteDC (hdcMem);πend;πππ{ ****************************************************************************π  Function: IsSelected()ππ  Purpose:  Specifies whether our image has been selected for dragging.ππ  Parameters:π    WORD wX     - X-coordinate of mouse positionπ    WORD wY     - Y-coordinate of mouse positionππ  Returns:π    Returns TRUE if specified point is in object's bounding rectangle,π    FALSE otherwise.ππ  Comments:ππ  History:  Date       Author      Reasonπ            3/9/92     PES         Createdππ  **************************************************************************** }ππfunction IsSelected (nX, nY: integer): BOOL;πvarπ  pt   : POINT; { POINT data structure  }π  rect_: RECT;  { RECT data structure   }πbeginπ{ Current mouse position }πpt.x := nX;πpt.y := nY;ππ{ Current bitmap position }πrect_.left   := domino.bmX;πrect_.top    := domino.bmY;πrect_.right  := domino.bmX + domino.bmWidth - 1;πrect_.bottom := domino.bmY + domino.bmHeight - 1;ππ{ Return TRUE if pt in rect of image }πIsSelected := PtInRect (rect_, pt);πend;πππ{ ****************************************************************************π  Function: BeginDrag()ππ  Purpose:  Starts the bitmap dragging process.ππ  Parameters:π    HWND hWnd_  - Handle to windowπ    int  nX     - X-coordinate of mouse positionπ    int  nY     - Y-coordinate of mouse positionππ  Returns:π    No return value.ππ  Comments:ππ  History:  Date       Author      Reasonπ            3/9/92     PES         Createdππ  **************************************************************************** }πprocedure BeginDrag (hWnd_: HWND; nX, nY: integer);πbeginπ{ Get all mouse messages }πSetCapture (hWnd_);ππ{ Save previous mouse position }πxPrev := nX;πyPrev := nY;ππ{ Get client area rect }πGetClientRect (hWnd_, rcClient);πend;πππ{ ****************************************************************************π  Function: Drag()ππ  Purpose:  Perform the bitmap dragging.ππ  Parameters:π    HWND hWnd_  - Handle to windowπ    int  nX     - X-coordinate of mouse positionπ    int  nY     - Y-coordinate of mouse positionππ  Returns:π    No return value.ππ  Comments:ππ  History:  Date       Author      Reasonπ            3/9/92     PES         Createdππ  **************************************************************************** }πprocedure Drag (hwnd_: HWND; nX, nY: integer);πvarπ  hdc_,               { Handles to dcs            }π  hdcMem   : HDC;π  hdcNewBkg,          { Handles to dcs            }π  hdcOldBkg: HDC;π  hbmNew,             { Handles to bitmaps        }π  hbmNPrev : HBITMAP;π  hbmOPrev,           { Handles to bitmaps        }π  hbmPrev,π  hbmTemp  : HBITMAP;π  dx,                 { Mouse delta x and delta y }π  dy       : integer;πbeginπ{ Get window and memory dcs for our BitBlt'ing }πhdc_      := GetDC (hWnd_);πhdcMem    := CreateCompatibleDC (hdc_);πhdcNewBkg := CreateCompatibleDC (hdc_);πhdcOldBkg := CreateCompatibleDC (hdc_);ππ{ Create a temp bitmap for our new background }πhbmNew    := CreateCompatibleBitmap (hdc_, domino.bmWidth, domino.bmHeight);ππ{ Select our bitmaps }πhbmPrev  := SelectObject (hdcMem, domino.hbmImage);πhbmNPrev := SelectObject (hdcNewBkg, hbmNew);πhbmOPrev := SelectObject (hdcOldBkg, domino.hbmBkg);ππ{ Calculate delta x and delta y }πdx:= xPrev - nX;πdy:= yPrev - nY;ππ{ Save previous mouse position }πxPrev:= nX;πyPrev:= nY;ππ{ Update image's position }πdec (domino.bmX, dx);πdec (domino.bmY, dy);ππ{ Copy screen to new background }πBitBlt (hdcNewBkg, 0, 0, domino.bmWidth, domino.bmHeight,π        hdc_, domino.bmX, domino.bmY, SRCCOPY);ππ{ Replace part of new bkg with old background }πBitBlt (hdcNewBkg, dx, dy, domino.bmWidth, domino.bmHeight,π        hdcOldBkg, 0, 0, SRCCOPY);ππ{ Copy image to old background }πBitBlt (hdcOldBkg, -dx, -dy, domino.bmWidth, domino.bmHeight,π        hdcMem, 0, 0, SRCCOPY);ππ{ Copy image to screen }πBitBlt (hdc_, domino.bmX, domino.bmY, domino.bmWidth, domino.bmHeight,π        hdcMem, 0, 0, SRCCOPY);ππ{ Copy old background to screen }πBitBlt(hdc_, domino.bmX+dx, domino.bmY+dy, domino.bmWidth, domino.bmHeight,π       hdcOldBkg, 0, 0, SRCCOPY);ππ{ Tidy up }πSelectObject (hdcMem, hbmPrev);πSelectObject (hdcNewBkg, hbmNPrev);πSelectObject (hdcOldBkg, hbmOPrev);ππ{ Swap old with new background }πhbmTemp       := domino.hbmBkg;πdomino.hbmBkg := hbmNew;πhbmNew        := hbmTemp;πDeleteObject (hbmNew);ππ{ Tidy up some more }πDeleteDC (hdcMem);πDeleteDC (hdcNewBkg);πDeleteDC (hdcOldBkg);πReleaseDC (hWnd_, hdc_);πend;πππ{ ****************************************************************************π  Function: EndDrag()ππ  Purpose:  Ends the bitmap dragging process.ππ  Parameters:π    HWND hWnd_  - Handle to windowπ    int  nX     - X-coordinate of mouse positionπ    int  nY     - Y-coordinate of mouse positionππ  Returns:π    No return value.ππ  Comments:ππ  History:  Date       Author      Reasonπ            3/9/92     PES         Createdπ            3/12/92    PES         Added code to restrict domino to visibleπ                                   area of screen.ππ  **************************************************************************** }πprocedure EndDrag (hwnd_: HWND; nX, nY: integer);πvarπ  hdc_,               { Handles to dcs                  }π  hdcMem: HDC;π  hdcNewBkg,          { Handles to dcs                  }π  hdcOldBkg: HDC;π  hbmNew,             { Handles to bitmaps              }π  hbmNPrev : HBITMAP;π  hbmOPrev,           { Handles to dcs                  }π  hbmPrev,π  hbmTemp  : HBITMAP;π  dx,                 { Delta x and delta y of mouse    }π  dy       : integer;π  x,                  { X and y for position correction }π  y        : integer;πbeginπ{ Calculate delta x and delta y }πdx:= xPrev - nX;πdy:= yPrev - nY;ππ{ Check if we've moved since last time  }πif (dx <> 0) or (dy <> 0) thenπ  beginπ  { Get window and memory dcs }π  hdc_      := GetDC (hWnd_);π  hdcMem    := CreateCompatibleDC (hdc_);π  hdcNewBkg := CreateCompatibleDC (hdc_);π  hdcOldBkg := CreateCompatibleDC (hdc_);ππ  { Create a temp bitmap for our new background }π  hbmNew    := CreateCompatibleBitmap (hdc_, domino.bmWidth, domino.bmHeight);ππ  { Select our bitmaps }π  hbmPrev   := SelectObject (hdcMem, domino.hbmImage);π  hbmNPrev  := SelectObject (hdcNewBkg, hbmNew);π  hbmOPrev  := SelectObject (hdcOldBkg, domino.hbmBkg);ππ  { Update bitmap's position }π  dec (domino.bmX, dx);π  dec (domino.bmY, dy);ππ  { Copy screen to new background }π  BitBlt (hdcNewBkg, 0, 0, domino.bmWidth, domino.bmHeight,π          hdc_, domino.bmX, domino.bmY, SRCCOPY);ππ  { Replace part of new bkg with old background }π  BitBlt (hdcNewBkg, dx, dy, domino.bmWidth, domino.bmHeight,π          hdcOldBkg, 0, 0, SRCCOPY);ππ  { Copy image to old background }π  BitBlt (hdcOldBkg, -dx, -dy, domino.bmWidth, domino.bmHeight,π          hdcMem, 0, 0, SRCCOPY);ππ  { Copy image to screen }π  BitBlt (hdc_, domino.bmX, domino.bmY, domino.bmWidth, domino.bmHeight,π          hdcMem, 0, 0, SRCCOPY);ππ  { Copy old background to screen }π  BitBlt (hdc_, domino.bmX + dx, domino.bmY + dy,π          domino.bmWidth, domino.bmHeight,π          hdcOldBkg, 0, 0, SRCCOPY);ππ  { Clean up }π  SelectObject (hdcMem, hbmPrev);π  SelectObject (hdcNewBkg, hbmNPrev);π  SelectObject (hdcOldBkg, hbmOPrev);ππ  { Swap old with new background }π  hbmTemp       := domino.hbmBkg;π  domino.hbmBkg := hbmNew;π  hbmNew        := hbmTemp;π  DeleteObject (hbmNew);ππ  { Tidy up }π  DeleteDC (hdcMem);π  DeleteDC (hdcNewBkg);π  DeleteDC (hdcOldBkg);π  ReleaseDC (hWnd_, hdc_);π  end;ππ{ Reset previous mouse position }πxPrev:= 0;πyPrev:= 0;ππ{ Release mouse capture }πReleaseCapture;ππ{ Make sure our domino stays completely visible }πif domino.bmX < 0 thenπ  x:= 0πelse if domino.bmX + domino.bmWidth > rcClient.right thenπ  x:= rcClient.right - domino.bmWidthπelseπ  x:= domino.bmX;ππif domino.bmY < 0 thenπ  y:= 0πelse if domino.bmY + domino.bmHeight > rcClient.bottom thenπ  y:= rcClient.bottom - domino.bmHeightπelseπ  y:= domino.bmY;ππif (x <> domino.bmX) or (y <> domino.bmY) thenπ  beginπ  xPrev:= domino.bmX;π  yPrev:= domino.bmY;π  Drag (hWnd_, x, y);π  xPrev := 0;π  yPrev := 0;π  end;πend;ππend.ππ---------- CUT HERE ---------- DRAGBMP_.PAS ---------- ππunit DragBmp_;ππinterfaceππ{ menu IDs }πconstπ  cm_DrawBmp = 101;π  cm_About   = 102;ππimplementationπend.ππ---------- CUT HERE ---------- DRAGBMP.RC ---------- ππBACKGROUND BITMAP πBEGINπ    '42 4D BE 25 00 00 00 00 00 00 3E 00 00 00 28 00'π    '00 00 40 01 00 00 F0 00 00 00 01 00 01 00 00 00'π    '00 00 80 25 00 00 00 00 00 00 00 00 00 00 00 00'π    '00 00 00 00 00 00 00 00 00 00 FF FF FF 00 48 55'π    '48 95 56 BE B6 EB 6D AB 62 20 44 91 5B AE B7 6F'π    'D7 FB 7B B6 B6 EF 5D 55 57 5A AB 6A 89 5A 4A 49'π    '49 56 B6 D2 24 B5 92 84 92 6A AD E9 ED B6 9A 54'π    '08 DA 91 24 F5 75 AD 5B 7D 56 D6 ED FF FE FB DA'π    'DA B5 AD 4A 72 24 94 AA 92 A9 4A AC C9 4A 24 29'π    '24 85 59 4F BB 65 75 D5 55 05 26 49 56 DB 76 F6'π    'D7 FD BD BB 6D DD EE B5 B5 56 52 B4 85 49 4A 91'π    '55 56 B5 52 12 B5 D1 4A 49 2A A7 7B 6E DD AA 5A'π    'A2 54 48 92 B9 AE DB AD FE D7 77 6E FF BB DD EB'π    '55 B5 AD 49 28 52 15 AA AA A9 56 AD 45 6B 02 10'π    '92 49 5A D6 DB B7 55 A2 8C 95 52 24 67 75 AD 77'π    'B5 BD ED DB DD F7 7B 56 AB 6A 5A B2 52 88 A8 25'π    '55 55 55 52 AB 4A A4 A5 24 B4 A5 2D B6 6D 76 5D'π    '51 22 84 88 DA DB 7B DD 6F 6B 5A AF 7B BF D6 DA'π    'D6 8D B5 4C 85 23 2A DA AA AA AA AD 44 B5 09 09'π    '49 01 5A DB 6D DB 4D E6 AD 4A 29 23 35 AE D6 97'π    'FD DE EF FA F6 ED 7D 95 2D 72 AA B1 28 4C 45 25'π    '55 55 56 A9 53 4D 52 52 24 56 A5 55 DB 76 F5 19'π    '52 55 4A 48 6B 7B B5 FA AB 75 BD 6F DF FF EB 76'π    'DA 8D 55 4A 53 11 12 D5 52 8A B5 56 A6 BA 88 94'π    '89 91 5A AB 36 DD AA F6 AE 82 90 92 9A D6 6F 2F'π    'FE EF 6B DD 7D AD DE AA B5 7A AA B4 84 24 6A 2A'π    'AD 7D 4A AA C9 52 21 21 B2 25 26 AA ED AB 5B 45'π    '51 55 25 24 2B B5 DA FB 6B D5 DE BB F7 FF B5 55'π    '49 95 6D 49 29 69 89 55 52 81 B5 2D B6 AD 4A 4A'π    '04 94 98 AB 5B 7E F6 BA AE A5 49 49 55 5F 77 56'π    'DE BF 75 D7 6F 7D 6E D5 B6 6A D2 AA 4A 02 52 AA'π    'AD 5E 4A DB 49 73 10 94 A9 22 63 AA B6 D5 AA CD'π    '52 AA 92 12 2E EA DA F5 75 EA AF 7E FD EB D9 2E'π    '49 AA AD 54 90 AD 25 55 52 A1 B5 35 B7 AE 45 21'π    '24 48 94 55 6D BE ED 32 AD 55 B4 A5 5B BB B7 AF'π    'EF 5D F5 D5 D7 DF 76 D1 B7 55 53 52 25 20 8A 4A'π    'AD 5E A2 EB 49 55 28 4A 49 93 2A A2 CB 6B 9A ED'π    '6A AA 42 88 35 6E ED 6A D5 F7 5F 7F FF 7E D9 2E'π    'AA B5 AD 44 48 4A 28 B5 52 A1 5D 56 B7 6A 82 92'π    '92 24 55 2D 3E DE F5 95 9B 55 B4 22 AA DB 9B 5D'π    'BF 6D F5 EB 5E F5 AA D3 55 4B 5A A8 95 92 D2 8A'π    'AA 8A A3 AD 6A AD 24 24 48 8A A9 52 D5 75 AB 6A'π    '74 AA 49 54 57 B6 76 F7 75 DB 5F 5F FB DF 75 2E'π    'AA B6 A5 51 20 24 05 55 25 55 5D 55 4D 55 49 49'π    '13 34 92 49 2A AF 5A 55 8B 5D B4 81 2C D5 DD AD'π    'EE B5 F5 F6 B7 76 D2 DA AA D5 5A 82 4A 92 AA 55'π    '52 AA AB AA BB AD 92 5A 64 41 24 94 D5 F6 F5 DB'π    '75 6A CA 34 5B 6F 6B 7B 5B EF 6F 5F FD DD A5 53'π    '55 2A A7 24 94 49 6A AA AD 55 77 6D 64 5A A4 80'π    '89 2A 89 21 2E AD 96 AA 96 95 3A 82 B5 BA DD D6'π    'F6 BA DA F5 6F 77 4D AD 56 D5 5C 49 21 92 95 55'π    '52 AA DE DA DF B5 09 2B 52 94 52 4A 51 5B 69 55'π    '69 6A C5 68 2A 56 B7 35 5D DB B7 AF DD DD 55 56'π    'A9 5A AB 12 4A 25 55 55 55 54 B5 95 A5 6B 52 48'π    '24 41 14 98 AD 6E B6 AA 96 AD BA 95 4B B5 DA EE'π    'F3 76 ED 7B BB 77 AB 59 56 A5 B4 A4 94 95 55 55'π    '52 AB EF 7A BA AC 94 92 89 16 A9 23 43 5B CA DB'π    '6A A9 4B 70 2C 66 B7 5B AE AD 5B D7 76 CE AA B7'π    '6D 5B 4D 09 21 55 55 55 55 55 7A D6 D6 EB 21 24'π    '52 68 22 48 3C D6 35 24 AD 56 B4 EA 93 DD 6A F6'π    'FB FB F7 7E ED BD 56 D4 C9 6A B2 52 4A 2A AA AA'π    'AA AA EF AB AB 55 4A 49 94 82 CC 95 43 2D EA DB'π    '52 F9 AB F0 2C A5 BF 4D B6 AD 5E D7 DB 6D AD 2B'π    '36 D5 48 88 92 AA AA D5 55 55 DA AE 5A D6 A4 92'π    '22 55 11 21 1C D7 55 B6 DD 87 6D E5 5B 5D 6D FB'π    '6B F7 F5 FE BD DB 5A DE CA AA B2 21 25 55 55 2A'π    'A9 56 FF 59 E6 BB 11 24 89 24 4A 4A 61 2A AB 24'π    'A3 79 4B D8 55 6A DB 2E DF 5D 6F DD F7 6E D5 31'π    '35 55 84 96 52 AA AA D5 52 A9 B5 57 5D 65 44 49'π    '34 89 B2 99 0B 5D B6 DB 5E 96 B7 B2 AA D5 B6 E9'π    'AA F7 DF B7 DD B5 AA EE D6 AA 51 20 C5 55 55 2A'π    'AD 57 FE DA 6A DF A9 92 42 52 04 22 54 5B 6A B6'π    'A9 69 EF 68 B5 16 6D BF 7F AE FA FE BA DE AD 52'π    'A9 52 84 95 2A AA AA D5 52 AB 7B 35 D5 A8 02 24'π    '94 94 A9 48 A2 AA 95 A9 56 B7 1E F5 4A ED DB 65'π    'D5 7D BF D5 F7 75 6A AD 56 AE 29 25 55 55 55 55'π    '55 6E F6 EE AA 57 54 89 31 21 22 9B 15 95 6E 57'π    'BA CA FB E8 B5 2A AE DD 7F DB F7 7F AD D6 D5 55'π    'AA A0 42 48 4A AA AA AA AA 9B ED 59 57 DA 85 22'π    '46 4A 4A 20 64 25 A9 DA 55 BD B7 DA 6A D5 59 B7'π    'DA FF 6D EB 7B 6D AA EA 54 94 94 93 5A 95 55 55'π    '55 57 BD D7 DA 35 28 4D 10 91 54 CA 89 9A 56 B5'π    'AB 53 7F 74 95 AA B7 6D 77 BA FF 5E EE DA AD 15'π    'AA A9 25 24 A5 55 55 AD 52 BE F6 9A 35 EB 52 90'π    '6A 25 12 12 22 25 AD 56 B6 AE DE FD 65 2A AD DB'π    'DE F7 DB FB DB B6 B2 EA B5 22 48 49 5A AA AA 52'π    'AA 6D ED 75 D6 96 84 4A 82 C9 64 A4 D5 5A A9 AA'π    'D5 59 7B EA 9A D5 55 36 BB ED BE B6 B6 6D 6D 2B'π    '49 48 92 92 A5 55 55 AD 55 DB BF D6 B5 6D 51 12'π    '54 12 09 92 04 8B 57 6D 5A B7 DF DE A5 2A AB EB'π    'EF BF FB ED EB D2 D2 D4 B2 11 24 A5 5A AA AA 52'π    'AA 37 FD 35 6A B3 0A 64 92 A5 52 24 A9 24 AA 9A'π    'A5 D5 7F BD 5A D5 56 5F BD 7B 77 5B 5E AE AD AB'π    '44 A2 49 0A A5 55 55 AE AB EF 6A DA D6 CE A0 89'π    '24 94 A4 89 24 AB 5D 75 DF 2D DB 77 45 2B 2D D7'π    '77 EE EE F5 F5 59 55 54 91 04 92 55 5A AA AA B1'π    '54 3E FF B5 99 B9 09 22 49 21 09 32 49 05 62 AA'π    'A8 DB 7F DE DA D4 EA BE EE DB FD AF AA D6 DA AB'π    '46 49 25 2A AA AA AD 4E AB FB DD 6B 77 57 92 4C'π    '92 4A 52 44 A4 6A 9D AB 57 2D DB FF A5 2B 15 6D'π    'FB FF D7 7B 6D AB 55 54 98 92 48 A5 55 55 52 B1'π    '55 6F BB 96 A9 AA 24 91 24 94 94 91 12 83 65 6D'π    '5A F6 BF B5 54 D4 AA DB DF BA BD EE DB 54 B5 55'π    '22 24 92 5A AA AA AD 4E AA DE FE 6D 57 75 49 4A'π    '49 21 21 26 49 5C 9A 9A B5 4B FB 7F D5 29 55 77'π    'B6 F7 F7 55 B6 AB 55 54 94 89 34 A5 55 55 69 B2'π    'AA BD EB AA DA CD 92 24 92 4A 4A 48 A4 13 6B 75'π    '6A BD 77 FF AA A2 2A DD 7F EE EE FF 69 56 AA A9'π    '21 12 41 49 5A AA 96 4D 6B FB BE D5 B5 BB 24 91'π    '24 92 92 92 49 6D 4A AA D5 D7 DF EB 54 4A D5 B7'π    'EE BD DD AA D6 AC D5 52 4A 24 95 56 A5 55 69 B5'π    '56 F7 FD AD 2B 52 89 26 49 24 24 45 12 82 B5 55'π    'AB 34 BD DF EA 95 29 6F 7D F7 B5 7B A9 B3 5A A4'π    '90 49 22 A9 5A AA 96 AA AD DF 6B 52 ED EE 12 48'π    '92 49 51 2A 49 2D 4D 6B 56 EF F7 FF 95 35 56 BD'π    'EF BE EF D6 B7 4E A5 49 24 92 4D 56 A5 55 6D 55'π    '53 BE FE AD 55 19 24 92 24 92 4A 88 92 52 B5 96'π    'AD 5A BD AF 68 44 A9 5B DE F5 B9 6D AA B4 DA 92'π    '49 24 92 A9 5A AA A9 6A EF 75 ED 69 AA F7 49 24'π    'C9 24 92 52 34 85 4A 6D 5A B5 F7 FE AE B3 56 BF'π    '7D EF 6F BB 55 6B 29 24 92 49 25 46 AA B5 56 95'π    '16 FF DD 96 B5 94 94 49 12 49 24 94 C1 2A B5 DA'π    'B5 E7 6F BF D1 4C A9 76 FB BD DA ED 5A 94 D2 49'π    '48 92 4A A9 55 4B 69 6A ED D6 FB 75 4B 6B 22 92'π    '44 92 49 21 15 45 56 2B 6B 5D FE F6 AE 91 56 CF'π    'EF FB 77 B6 B5 6B 24 92 22 26 95 56 AA B4 96 D5'π    '5B 7F DE AA B6 9E 54 24 99 24 92 4A A4 9A A9 D4'π    'D6 B7 6D FF D5 57 54 BE DF 56 AD 6D 6A D4 D9 24'π    '89 48 2A AA AA AB 6A A5 D7 FD B5 55 55 71 02 C9'π    '22 49 A4 92 49 29 56 5B AC ED DF B7 AA A8 2B 5D'π    'FA FD FB D9 AD AB 22 49 22 25 54 A5 55 55 55 5E'π    '1E EB FD AA AA AE 54 12 48 92 12 24 92 42 A9 B5'π    '5B 9B 7B 7F 55 55 D4 AB DF EB AE B7 52 56 49 2A'π    '4C 92 AB 5A AA AA AA A1 F5 DF EB 77 55 55 89 44'π    '9B 24 A4 C9 24 95 56 A6 B5 76 B7 F6 BA AA 13 5F'π    'BB 5F 75 EA AD A8 92 40 91 24 54 A5 55 55 55 5E'π    '5F FF 5E A8 AD 6A 22 5A 20 49 89 12 49 24 AA D9'π    '4A DD FE EF E6 D5 6C AB 7F F6 DF 55 5A 55 24 95'π    '24 49 4B 5A AA AA A5 A1 AB BA F2 D7 55 AA 48 81'π    '4A 92 34 A4 92 49 55 2E F5 B7 6F DF D9 AA 93 3F'π    'F5 5D B6 EB 55 D4 49 24 49 55 54 A5 55 55 5A 5E'π    '7F 77 DF 29 5A 55 11 2A 52 24 82 49 24 92 AA D1'π    '97 6D DD FE B7 55 24 C7 6F FB 6C 96 AA 29 A2 49'π    '92 84 95 4A AA AA A5 A1 D6 EF 7A F6 A5 AA A6 44'π    '84 A9 28 92 49 25 55 2F 6C DB 7B AF EA AA AB 3E'π    'FF D6 DB ED 55 C4 14 94 24 29 55 55 55 2B 5B 5F'π    '7F FD F5 95 5A B5 08 99 2A 42 4B 24 92 49 2A D9'π    '57 B6 DF 7E DD 55 54 4B DA BD B6 AA B2 29 41 22'π    '89 4A AA AA AA D4 AA A2 D5 DB EF 6A B5 4A 52 22'π    '49 16 90 49 24 92 55 36 DC ED BB FD B2 B5 52 B7'π    'FF AB 6D 5B 44 8A 2B 48 B2 55 55 55 55 2B 55 5D'π    'BF BF BA AA A5 B5 85 54 92 50 2A 92 49 24 8A D5'π    'AB 96 F6 D7 EE A6 94 8B B5 76 B5 A4 A9 50 C8 12'π    '84 AA AA AA AA D6 AA A5 7B 77 76 D6 DB 4A 28 49'π    '24 A5 52 48 92 49 29 2A 55 7B AF FF B9 59 62 27'π    '7F DD DD 5B 51 05 12 A4 A9 53 55 55 55 2C B5 5B'π    'F7 FE DD AD 2A B5 42 92 49 09 24 93 24 92 52 EB'π    'AD AD 7D BF 76 B6 9D 4A ED 77 76 B5 56 48 45 29'π    '22 AC AA A5 5A D3 4A B6 EE D7 FB 5A D5 4A 2D 24'π    '92 52 49 24 69 45 25 2C B7 6B D7 F7 E9 D5 62 BB'π    'DF ED A9 AA A0 92 98 4A 55 53 55 5A A5 2C B5 AB'π    'DB FE B6 D5 5A B5 40 49 24 94 A2 49 02 2A 5A DB'π    '6C DD 7F 6E DF 2A 9D 45 FD 5B 77 55 55 24 A2 94'π    'AA 96 B6 A5 5A D3 56 AF 7F B7 FD 35 65 4B 95 92'π    '49 21 0C 92 AC C0 42 A5 AB B7 DD FF FA DD 61 2B'π    'BB F6 4C AA A4 49 14 A5 55 6D 49 55 55 2D 69 5A'π    'F6 FE FB EA 9A B6 24 24 92 4A 51 24 21 15 95 5D'π    '5E ED 7B BF B7 32 8A 4B 77 EB FB 5A A9 22 49 1A'π    '25 AA B6 AA AA DA 96 B7 EF B7 D6 95 65 69 49 49'π    '22 42 19 25 59 80 85 4B 57 6F BB FF F5 BA C2 57'π    '77 EC 99 55 48 92 29 4A AA DA 92 AA AA 5A D2 B5'π    'ED FD F7 D5 35 6C 92 92 4C 94 A2 48 42 2B 2A BA'π    'BD DA F7 7F 6E 65 14 96 EF D7 F6 B5 52 44 92 34'π    '4B 55 6D 55 55 B5 2D 6F DF 6F AD 2A CA D3 24 49'π    '21 25 88 92 94 88 45 56 D3 37 AF ED D9 DA 65 2D'π    'BE BD 4A AA A5 29 44 AA B4 AA A9 55 6A AA D5 BD'π    'BB FB 7A D5 B5 AE 49 12 4A 48 33 44 A1 32 AA A9'π    '5E ED 7E DF F6 AA 88 57 7D D2 B5 55 48 42 29 48'π    '4B 55 56 AA 95 55 55 5B F6 DF F7 AB 4B 51 92 A4'π    '94 92 84 15 16 45 0A B7 B5 BB DD FF 6B 55 25 4D'π    'DB FF D6 EA 92 98 8A 35 B6 AA A9 55 6A AA AB 77'π    'BF F6 ED 56 B6 AE 24 49 21 24 52 A8 48 88 4A AA'π    '6B 57 7B BE DD B5 52 97 36 AA 29 15 24 A2 11 6A'π    '55 55 56 AA AA AA D6 DF 6D BF DA A9 55 55 49 12'π    '4A 49 88 92 A2 32 95 6D D6 BE D7 7D F6 CA 88 2A'π    'DF FD D6 EA 51 09 2E D5 AA AA A9 55 55 55 2D BE'π    'FB EE F3 56 AA A9 92 54 90 92 33 24 94 C4 A5 4A'π    'AD ED BF F7 AD BE B3 4B BB F7 4D 14 A6 54 52 AA'π    '55 55 56 AA AA AA D5 75 DF 7D DE AD 6A B6 24 C2'π    '23 24 84 49 25 11 0A BB 5B 5B 76 EF FB 51 44 55'π    '6E AC BA F5 08 91 0D 55 AA AA A9 55 55 55 AB EF'π    'B7 DF B5 6A DB 49 49 19 6C 49 29 12 48 56 6A D5'π    '76 D7 ED BE AD EE A9 0A BF FB 55 0A 52 24 AA AB'π    '55 55 56 AA AA AD 5D 5E FE FA F6 D5 24 B7 92 42'π    '01 12 52 64 92 80 85 AA CD BE 5F FF FB 55 52 AB'π    '5B F5 AA F4 A4 D1 35 56 AA AA A9 45 53 5A AB FB'π    'ED B7 ED AA DB 6A 34 94 D2 66 A4 89 24 B5 2A AD'π    'BB 6D FB 6D D6 DD A8 24 B7 6E 55 09 09 0A 4A B5'π    '55 55 57 5A AC 55 55 B7 BF FF DA 55 55 55 41 29'π    '14 88 49 52 49 04 4B 5B 56 DB 56 FF BD B2 43 4B'π    '6E F9 AA F4 52 A0 B5 6A AA AA A8 A5 53 A9 6F 6F'π    '7B 6E B5 D6 AA AB 2B 52 45 22 92 24 92 49 54 B5'π    '6D B5 FD DB 6B 6D B4 2A AB EE B5 09 94 2A 5B 55'π    '55 55 57 4A AC 56 DA FD F7 FD E6 99 55 54 44 24'π    'A8 4D 24 8A 44 B2 8B 6A BB 5F 57 BF FE DB 4A D5'π    '57 F9 4A F2 21 44 B6 AB 6A AA A9 55 53 AA 97 DF'π    'EF 6F BD 66 AA B7 99 49 12 D0 49 50 99 04 2A AB'π    '56 EA FE FE A9 76 A9 2A AD D6 B5 04 96 91 49 5A'π    '95 55 56 AA A4 55 7D BB 5E FD EA 9A D5 68 A2 92'π    '42 05 92 25 22 49 55 56 F5 BF AD F5 FF AD 5A 95'π    '53 79 55 69 48 24 BF 65 6A AA A9 25 4B 2A AB F7'π    'FB D7 9A B5 2D 4F 4C 24 AC AC 24 8A 48 B2 4B 6D'π    '2F 55 7B DF AA F9 A5 6A 6E F6 D5 8A 22 89 4A DA'π    'AA AA 96 C8 98 55 6E BE DF 7F 75 6A D2 B1 91 49'π    '11 21 49 50 92 84 96 AA EA FF AE BA FE B7 5A 95'π    '93 E9 2A 30 94 B2 B6 AB 55 55 69 13 65 AA DB ED'π    'F5 FD DA D5 5D 6E 2A 22 42 4A 92 26 A5 29 29 5B'π    '5D AA FB F7 AB ED B5 6A 6D 36 D1 45 49 05 4D D6'π    'AA AA 95 74 94 15 6F FF DF D7 B5 AA A2 D2 A8 CC'π    'AC 94 24 88 08 42 56 AA B7 7F AE BD 7E DB 6A AA'π    'D6 E9 2A 91 22 52 BB 6D 55 54 AA 81 21 4A BF 5B'π    'B7 BF 6B 56 DD AD 55 11 09 21 49 25 52 95 4A BB'π    '6D DB 7D FB AD B6 DB 55 9D 55 55 26 4C 95 56 BA'π    'BA AB 54 AA 4A 5A EA FF 7E FA DC A9 25 55 2A 4A'π    '52 4A 24 48 94 A2 5D 65 5B 76 AB 76 FB 5D B4 AA'π    '6A 94 AA A8 91 22 AC D5 65 54 A9 48 92 A5 BF FB'π    'ED EF A3 56 DB 5B 54 A4 A4 98 C9 B3 21 14 AA DA'π    'F6 ED FD ED 96 FB 6B 55 DA 23 2A 45 24 55 53 B6'π    'DA A9 56 93 24 4D 77 D7 5F DF BE B5 55 64 AA 91'π    '09 23 12 04 5A 49 52 AB 4D 97 57 7B 7D B6 DE AA'π    '54 89 55 12 49 85 5D 6D AB 55 29 48 51 5A EE BE'π    'FD BA 65 4A AA 9B 49 4A 52 48 44 AA 80 A2 5D 56'π    'BB 7D FD F6 D7 6D B5 55 95 22 14 A8 92 2A E7 5B'π    '6C AA 55 25 26 85 DD FB AB F7 DA B5 55 76 92 24'π    '92 92 99 49 2B 49 A2 DA D6 D7 56 ED BD D7 6D AA'π    '74 45 CA 93 25 57 1A EE AB 55 42 4A 48 3A BF D7'π    'FF BE B5 55 69 A5 24 91 24 25 23 32 48 12 5D AB'π    '5D BD FB D9 6A BE DB 55 89 08 15 44 48 28 EF 59'π    '5A A8 AC 94 D2 CB FB BE AF 75 EA AA 97 5A 49 24'π    '49 4C 94 84 92 E5 A5 5A B7 57 FF FF DF FF FE FF'π    'FE 52 FE BD 12 D7 FF D7 B5 55 D1 21 E5 35 77 FF'π    'FA EF 55 55 6D 53 12 49 B2 51 29 29 64 FA 5A B7'π    'EC FD 7F FF EF FF FD FF FF 87 FF 9A 65 5F FF FA'π    '6A AB E4 4A F2 CB FF FF DF BA EA AA A9 6E 64 92'π    '4C 84 A2 52 09 E1 66 C9 FB 97 EE B5 4E A6 CA C4'π    '55 5F EA FC 0A BF ED 7D D5 55 A1 92 E1 36 EF 6B'π    'F6 EF AA AA D6 D2 09 26 91 2A 89 04 D4 EA 99 37'π    'D6 FD 5B D6 A5 DD B6 19 AA 3F 41 5A 95 7F 5A D7'π    '6A 8B 82 25 D8 CB F5 D5 6D BA 55 55 2A AD 52 48'π    '22 49 36 69 2B F9 66 CF A9 AB F6 FB 42 B7 6C 22'π    '28 F8 14 98 95 7A B7 5A 95 33 D0 89 E0 35 FA BE'π    'DF FF EA AA D5 55 88 92 AC 92 40 92 C5 C4 59 BB'π    'B9 7F 6D D6 01 DA D0 08 90 FA A0 23 25 F5 60 35'π    '6A 47 A1 53 98 CB 6F 01 F9 6A B6 AD 5A AA 32 A5'π    '21 24 95 44 19 BA 27 57 54 D6 DB 2C 03 37 A0 3B'π    '48 E0 00 18 52 F6 C0 2A D4 AF 08 87 E4 35 FC 00'π    'D8 FF E9 52 A6 B5 44 8C 4A 4D 24 29 A3 C4 58 AF'π    '78 BD 6F F8 16 FD 40 4C 11 CA 80 BE A1 ED 00 D7'π    '45 57 50 2B 98 57 F6 0F BC ED 56 AD 59 6B 91 32'π    'A4 90 89 4A 17 94 27 57 A4 55 BB A4 2D B3 40 9E'π    'D1 D0 01 59 59 DA 85 BC C4 86 94 4B 74 2B 6C 3B'π    'FA 5B E9 5A B6 D6 26 84 92 25 32 A0 A7 6A 18 DE'π    'DC 3A EF FC 3B 7E C5 2D 21 C2 0A 1E E5 B5 0B 7B'π    '92 2F 20 97 4A 56 F8 37 D6 7E B6 D5 65 6A 48 29'π    '21 4A 44 15 2F 95 27 BF 36 6F B7 68 6A F5 40 4E'π    'D3 A4 00 BD 1B CB 06 9D 60 DE 48 2F B4 2F EC 6F'π    'FE 2B EA AA DA 96 95 62 4A 59 11 45 57 AA 1A 2E'π    'EC 1A DF 54 4F BE 82 9D 23 88 12 3A E3 B6 14 FE'π    '81 0C 92 27 5B 15 D8 7B AA 3E D5 55 26 F5 21 0C'π    '91 02 66 AA 27 55 95 DF 5B 37 77 F4 7A 75 84 AE'π    'D3 50 04 5D 43 EC 17 AD 50 5D 24 4F 66 2F BC 5E'π    'DE 1D AA AA DA 8D 4A 51 22 68 88 48 9F 2A 0A 5E'π    'B6 3D DF EC 2D F2 45 1D 23 42 28 BA A3 4A 2A 6E'π    'A0 9C 4A 1E 9D 1B F6 FF F6 37 F5 55 55 7A 99 24'π    '94 8B 25 93 4E D5 85 BD 6D 0F 77 B4 57 72 80 AE'π    'D3 94 01 3A C3 BC 2D DD 28 3A 99 0D 6D 0F 5F FA'π    'AC 3D 4A AA AB A5 22 49 21 20 52 24 5D 2F 4B 5D'π    '5F 1E DF EC 7D 7D 05 5D 23 40 2A 5D A3 A2 16 AD'π    '40 7C AC 1E D6 96 FD F7 FC 37 F5 6A AC 5B D4 92'π    '4A 4D 09 52 9E 52 8D 7B B5 9D F7 58 2A F2 42 AE'π    'D3 94 00 BB 43 DE 1B 5C 90 B9 09 1D 25 8D F7 DD'π    '58 6D 4A 95 7B EA 09 24 94 91 6A A5 3D B3 42 BE'π    '67 0B DF 74 6D BC 85 5D B3 20 12 5E A3 34 34 BF'π    '20 3A 4E 1A E7 4B DF FB 70 7B F5 6A C5 2B A2 49'π    '21 24 11 2C 9A 63 45 7D C6 87 B7 A8 5B 71 04 DD'π    '23 84 05 5A C3 EA 0B 6C 48 72 85 3D 43 4F BF 5F'π    'A0 EF 4A 95 BA D6 2C 92 4C 8D A6 A2 3D 91 A2 F5'π    '23 CF 7F EC 36 B4 43 3E D3 28 10 5A A3 96 36 DE'π    '90 F4 46 BA A2 83 7B EA 81 DA F5 6B 4B 6D 41 24'π    '92 50 10 49 7A 61 62 FA E3 46 EF 58 6D 7A 84 CD'π    '53 80 22 BF 43 6A 0C AC 40 6A 87 76 C3 66 F7 5C'π    '03 BF D2 AC B6 92 14 49 21 25 65 52 B5 81 C1 7B'π    '43 C5 BF 34 5A B0 83 3E A1 2A 04 BA C3 DA 3B 5E'π    '88 F1 02 7B 43 C5 FD F0 0D 76 AD 5B AD 7D A5 92'π    '4C 89 0A 45 72 61 B3 E6 83 A7 FF EC 35 35 04 6E'π    'D1 40 29 7D 23 94 14 DD 10 E4 87 B4 85 A3 6E A0'π    '3B ED F2 A4 6A C2 28 24 91 32 52 AA 7D 81 C0 FD'π    '45 C3 7F 58 5F FA 43 DD 21 88 02 DE E1 F6 2B BC'π    '20 D5 0B 5B 03 A1 FB 80 7F BF 45 5B DB 3F 45 49'π    '22 44 A4 45 72 42 F1 F2 83 F1 FF 94 77 F0 84 2E'π    'C1 92 15 B9 82 D5 2D 7A 41 D2 05 AA 85 F3 77 03'π    'FE FD F9 65 14 D2 A9 2A 4C 91 0A 94 F5 81 51 ED'π    '05 B3 6D 7C 2F 25 23 DD 50 A0 13 5F 61 AD 1A BC'π    '91 ED 0B 55 07 D1 FA 0E BC EB 42 9E FB AD 12 40'π    '91 2A A9 53 F2 46 D1 D5 86 E1 FD D0 52 4A 54 3D'π    'A1 4A 04 BC 82 DA 13 79 21 92 15 B6 0A D1 EF 0D'π    'FA 3F F5 69 45 36 44 95 A2 A4 92 04 C5 85 ED AB'π    '0B D8 DA DC 54 98 8B FD 40 00 4B FB 61 35 CD F4'π    '43 AC 0B CD 07 F9 7B 9B EE 3D 49 56 BA E9 D9 24'π    '16 49 24 B3 DD 01 7B DA 0E F9 FF B4 21 22 44 FA'π    '90 AA BF D4 A2 EB 3F E1 3F D3 3F B9 8F D6 F7 7F'π    'DC 2B F2 DA D7 56 02 49 40 92 49 45 E2 87 73 D3'π    '19 F8 B4 6C 4A 44 83 A5 A0 00 2F AB C1 56 FF 94'π    '3F AD 1D 56 9F FE BE DE B6 3F D5 55 AA AD 54 92'π    '5D 24 92 AB AD 0C BD AE 17 74 7F D8 52 89 44 5A'π    '41 49 55 2C A1 6C 8A A2 39 52 9B 65 5E DB AD B5'π    'EA 2E AA B6 B5 52 92 44 81 49 29 27 D2 0B 5B B4'π    '1D EC EE B4 24 32 83 B5 82 12 56 DB A2 DB 75 88'π    '04 AD 45 9D 63 76 9B 7E BC 3D F5 4A D6 ED 24 92'π    '52 52 45 4B A6 0A B5 54 2B 7C 7D AC 49 44 84 AA'π    '00 80 2D 1D 21 A4 14 00 13 5A 82 AA C1 DD 8E EB'π    '8A 2F CA B6 AA 95 49 24 95 08 94 A7 94 15 7A A8'π    '16 FA 5B F8 52 50 83 40 00 2B 40 1A E1 5B 80 00'π    '00 00 04 00 02 00 0B 80 00 3D B5 55 55 6A 92 49'π    '20 B3 2A AF 4A 1B 5D 54 3B D6 7F 54 24 97 85 58'π    '11 40 A8 1B 42 AD 50 01 58 00 02 00 01 00 06 A0'π    '0E 3B 55 6A AB AB 24 92 4D 44 55 57 54 0A BD B4'π    '6E BE 37 F5 49 50 2A B3 22 17 52 BE A1 D2 A4 92'π    '44 B5 56 D5 DB 77 5D F7 5D EF EA 95 74 54 89 24'π    '90 91 2A A7 4C 36 CF 50 5B FE 1F EA AA 25 52 AD'π    '44 41 6E FD 62 2D AA 28 9B 4A AD AB 76 DD F7 BE'π    'FB BA B5 6A AB AB 32 49 23 2A 95 4E A0 0A BE A8'π    '36 BD 3F B5 50 CA AA B2 10 8E 91 9A C1 D5 50 83'π    '2A B5 59 56 AB BB AE F5 B7 EF EA D6 D4 6C 44 93'π    '48 44 6A AF 5C 3D 5D 50 6D DB 17 EC A5 12 4A AD'π    '45 11 6F FD A2 55 AA 58 55 55 A7 54 EE F7 7B EF'π    'EF 7D 95 A9 35 93 91 48 15 29 95 1D 40 52 FD 60'π    'DB 7E 9F B2 59 4C AA B2 10 2E D2 FD 41 B5 41 02'π    'AA AA 5A 6F BB AA D7 5B 5E DB 7B 56 DA 6D AA 92'π    'B2 4A 52 BE 58 2D 9D 90 B6 DD 97 EC 22 31 45 68'π    '82 55 AD D3 A3 4B 54 55 55 55 AD D5 6D 7F BE F6'π    'FB F6 D4 AA A4 AA 52 A4 80 B2 AD 7D A0 53 7B 61'π    '6D BF 0E 9A 09 46 AA 82 24 AA 56 EE 42 B6 81 12'π    'AA AA B2 A5 D7 D6 ED DF AF BD AB 55 59 55 A4 89'π    '2D 45 52 BA 50 AE BC 90 B6 FD CB EC 14 A9 4A A5'π    '48 55 A9 79 A1 55 2A 45 55 55 4D 5E BD 7D DF 7D'π    'FD 67 35 5A A5 55 89 32 49 15 95 FD AC 77 F3 6F'π    'DB FF 77 40 25 24 95 48 01 B6 B6 B6 A2 AA 40 9A'π    'AB 55 BB AB EB D7 7B F7 57 DC EE A5 5A 56 B2 44'π    '92 6A 2B FA 5C CF FD 5F 6F FE D5 D0 0C 92 46 91'π    '52 54 D5 69 41 55 15 25 54 AA 55 56 DF 7D D6 AD'π    'FD 77 51 5A A5 29 45 11 24 95 55 D5 A2 2E DA AA'π    'B7 ED B5 22 52 49 19 22 05 AB 2A 96 A2 A8 40 4A'π    'AB 55 AA AD B6 CA BD FB D7 AD AE B5 5A 56 B4 B5'π    '4A 22 AA AA 5D 0B 55 5D DC BB 6C DC 89 24 66 88'π    '51 54 D5 69 A2 A5 14 95 54 AA 55 5B 6D BF F7 AF'π    'BE FA B2 AA AA AA 49 02 11 4C 49 24 A5 16 AA EB'π    '0B D6 D8 21 B4 92 8A 50 85 55 AA 96 41 48 41 2A'π    'AB 55 B5 56 DB 55 5D FF 7B AB 6E D5 76 95 B2 58'π    'AC 51 12 40 00 0A 80 00 0E 80 00 6A 01 24 54 82'π    '2B 6B 55 69 A2 92 8A 55 55 5A 6D BD B6 FF F7 BA'π    'EF 76 D5 2A 8A AA 04 A5 21 8A A4 90 00 15 00 00'π    '05 E0 00 14 AA 4A 96 B4 0A 96 AA 96 42 A4 10 AA'π    'AA A5 D3 6B 5D D5 BE F7 DE DD 2A D5 75 45 69 09'π    '4A 24 2D 65 AB 6E D5 AF AF 5E D4 69 48 AA A9 80'π    '55 6D 55 6D A2 A9 25 56 AD 5A AE DA F7 BF 7B DF'π    'FD B2 F5 2A 96 AB 92 56 11 49 D2 14 55 49 2B 7D'π    '7A E9 A9 54 95 55 56 68 96 D2 AA AA 52 42 49 29'π    '52 AB 35 B7 AD 6D F7 7D 5B 6D 96 D5 6A D4 24 90'π    'A2 5A 15 C5 AA B6 EC DB EF BF 2A 2B 22 AA AD 81'π    '2D 2D 55 55 AD 28 92 56 AD 54 EB 6D 7B DB EF FB'π    'F5 B5 69 2A D5 93 49 25 2C 81 64 2A AA B5 53 BE'π    'BD 6A D8 AC AC 55 4A 2A 5A EA AA AA 52 42 24 A9'π    'D2 AB AE DB AE BF BE EF DF 6B 56 D6 96 6C 24 4A'π    '41 2A 95 45 55 BA AE F7 FB DB 65 13 51 AA BA 80'π    '25 55 55 55 AC 94 89 56 2E AD 35 B6 FB F5 6D DE'π    'BA D6 AA AD 69 DB 49 98 92 52 2A 95 56 C5 55 BE'π    'F6 B6 94 2C AA 6B 52 28 DA AA B2 AA 51 21 24 A9'π    'D1 5A ED 6D B6 AF FF BB F7 9A D5 2A 96 52 92 23'π    '24 84 C0 35 6D 3A EB 6D AD ED 61 5B 55 AC AD 41'π    '2A D5 4D 55 A4 94 49 56 AE EB 5B DB 6D FD DA FE'π    'AD 75 36 D5 6D EE 34 88 49 2A 2B 42 92 C5 96 FF'π    'FB 5A 8A 14 AA 53 54 0A 55 AA B1 56 4A 42 92 D5'π    '51 9A B6 B6 DB BB 7F D7 FB 4A C9 5A A9 55 41 35'π    '13 48 94 95 6E BB 6D DA B6 B6 B5 2B 55 AC B5 50'π    'AB 55 46 AC 91 28 25 2A AF 66 ED ED 77 77 D7 7D'π    'AE B5 B6 A5 57 DA 96 41 60 15 52 25 51 56 9B BF'π    'ED ED 44 14 EA 53 54 04 5A AA A9 59 24 82 92 D5'π    '52 5D 5B 5B DE EE FE FF 79 6B 4D 5A AA B3 50 AA'π    '0D 69 24 94 AE A5 76 FB BB 5A 39 57 95 AC AA A8'π    'ED 55 4A A2 4A 24 45 2D 2D A9 D6 D6 BB DD DD EB'π    'D7 56 B2 A5 55 AE A5 09 51 02 49 63 D2 DA AD EF'π    '6A D5 82 09 6A 53 58 01 93 6A 92 A8 91 49 1A DA'π    'F5 57 3D BD F7 7F B7 DF 74 AD 4D 5A D7 75 54 52'π    '42 55 2A 08 2D 35 5B BE DF BA 34 9E 95 AC D1 29'π    '6D 52 A4 93 4A 22 A5 55 2A BA E7 6B 6E F5 FF BE'π    'CB 72 B5 65 2D DB 69 A4 94 92 48 D5 D2 CA B6 FB'π    'B5 65 4A 23 7A B3 2A 42 9A A5 0A A4 24 8A 4A AA'π    'D3 55 BE DE DD EF DD 7B B6 CD 4A 8A DB 2E 94 09'π    '29 24 93 22 2D B5 6B F7 6B 5A A8 8C A5 4C E0 89'π    '6A AA B2 12 D1 24 95 55 6E D7 6D B5 BB DF BB F6'π    'CD 32 B5 6B 56 F5 6A B2 42 49 24 4A D5 4A DF AE'π    'DE E5 55 13 5A B3 0A 12 D5 A4 84 A4 04 51 2D 56'π    '95 3A DB 6E EF BD 77 EF BA ED 4A 94 AD AD 55 44'π    '90 92 4A 91 2A B5 B7 7D B5 9B 28 2A EB 4D 60 4D'π    'AA 29 29 29 AA 8A 52 D9 6A D7 56 DB BB 7B EF 5B'π    '55 53 5A AB 57 5B AA 91 2D 44 92 56 D5 4D 2E FB'π    '6F 75 55 45 54 B5 04 91 55 D2 52 42 20 22 AD 26'π    'D5 6C FD B6 EE F7 FE FE AA AC A5 56 BC F6 AA A6'π    '41 29 4A A1 2A B2 F5 EF 5A AA 2A 12 AB 6A 49 2E'π    'AA 24 84 94 8A 95 52 DA AD 9B 97 6D BB EF 5D EB'π    '55 D3 52 55 6B AD 55 48 92 4A 24 4A AA AD 9F DA'π    'F5 D4 D4 A5 D6 94 90 51 55 49 29 25 21 2A AD B5'π    '53 76 FA D7 6F DE FB BE AB 2C 95 AA AD 6B BB 55'π    '24 90 C9 52 55 73 7B BF 5F 2B 2A 0A 2D 75 22 AE'π    'A4 92 4A 48 4C 55 55 26 AE AD AF BD DE BD EF 6D'π    '56 D3 2B 56 DB 5D 64 B2 49 25 12 45 AA 8E B7 7A'π    'EA D8 A8 A1 DA 94 84 51 49 24 90 92 A2 AA DA DA'π    'B5 5B 75 6B 7D FB BD FA AD 2C AA AD B6 EB DB 4D'π    '52 49 65 2A 55 68 EF F7 BB 52 2A 0A B5 6A 49 AA'π    '95 49 25 24 09 55 25 B5 6A F6 AE DD D7 F7 F7 D5'π    '5A D2 55 55 6D B6 A6 B5 40 92 08 49 AA B7 5D 6D'π    '6E A4 D4 91 4A A9 10 55 21 24 49 49 56 AA DA 4A'π    'AB 4D 7B B7 7F 5F 5F BA B5 55 AD 6D B7 6D 5D 4A'π    'AD 24 A3 4A 95 59 6B FF DA A9 29 24 B5 54 41 15'π    '4A 49 92 22 4D 55 15 B5 5D 7B D6 ED FE FA FA E5'π    '55 94 52 9B 6C CB B2 BD 4A 49 4C 15 2A A6 BF ED'π    '6D 92 55 49 55 52 92 69 14 92 24 88 BA AA EA AB'π    '6A AD 7D BB ED EF EF D5 6A 2B AD F6 DB BE 6D 52'π    'B0 D2 11 69 55 59 EF 5F DA 24 A8 12 AA D4 40 96'π    'B1 24 89 22 A5 55 15 54 D5 EB D7 57 5B BF BF AA'π    '95 54 6A 9D B6 D5 D5 AD 4E 08 A5 04 AA B6 9A FD'π    '74 C9 5A A4 57 55 12 2A 46 49 34 89 5A AA AA AB'π    'AB 3E BA FE FF FD 7A A5 6A AB D5 73 6D 6A 56 B3'π    'B0 A5 88 51 55 45 77 FB A9 12 A4 91 2C A8 40 54'π    '90 92 42 23 6B 55 55 55 36 E5 EF AD F7 6B F7 AA'π    'D5 54 95 AE B5 DD AA AE 4D 52 35 A6 AA BA DF D6'π    'F2 44 B9 24 AB 52 88 95 25 24 94 8A 54 AD 35 6A'π    'EB 5F 55 7B AE FF DF 55 AA 5B 6E B5 DB 2A 5D 69'π    'B2 08 82 09 45 4A AA BF A4 99 44 A9 15 54 11 55'π    '4C 49 29 25 AB 52 CA 97 56 EA FF D7 7F EE BC AB'π    '55 A5 55 6F 6D F5 6A D6 6D 55 28 B5 2A B5 BF FE'π    'D1 22 B9 42 4E A1 20 08 91 92 42 4A 76 AD 35 6A'π    'AD BF 55 BE DD DD FB AA AA 5A AD DA B7 4A D5 AD'π    'D2 A1 4A 82 55 4B 57 F5 64 49 52 94 95 5A 42 53'π    '24 24 94 95 C9 55 4A DA D7 6D FF 6D BB BF EE B5'π    '55 2A DA B6 EC B5 5B 5A AA 8A 11 2C AA B4 BE AF'π    'A8 92 A9 29 2A A0 84 94 49 49 2A 2A B6 AA B6 A3'π    '5C DB 55 DA FF 7B BD 4A AA 56 B5 AD AB D6 AA 55'π    '55 54 AA 41 55 4B 6D FE C1 25 72 52 65 4A 28 21'π    '12 22 61 5B 4D 55 49 5E B3 B5 FE B7 DB F7 7A B5'π    '54 A9 4B 76 DD 54 B5 B5 DB 51 25 1A AA 96 DB F5'π    '92 4A AA A4 8A D0 80 8A 66 CD 0A 26 BA AA 36 A9'π    '6E DF 5B ED B6 EE D5 4A A9 56 B6 CD B6 A9 CA 66'π    '24 A6 48 A1 55 65 37 AF 24 12 D2 99 55 45 11 12'π    '88 10 54 DA D5 6A C9 56 D5 72 F6 BB 6F DF F5 B6'π    'AA 35 6D BB 69 AA 35 DD DB 50 92 16 A4 9A EF 7A'π    '88 A5 29 22 15 10 22 24 52 A5 A1 2A AA A5 2A AB'π    '5B DF AD D6 BD 7A AE A9 54 CA DB 6E DF 54 D6 AA'π    'AD 55 25 69 5B 65 5A EF 21 0A F2 48 AA 45 40 49'π    '24 94 0A DB 55 4D 55 54 B6 B5 7B 6B EB F7 D5 56'π    'B1 35 B6 D5 B4 A9 6D 55 52 AA 48 02 44 9A B7 DA'π    '4A 25 44 93 2A 88 05 12 89 21 55 B5 5B 5A AA AB'π    '6D EF AE BE BF EF 7A E9 46 4E ED BD 6B 52 AA DA'π    'BB 54 92 D4 95 45 6D B6 A0 4A B1 24 56 11 10 24'π    '52 4A 49 56 E4 B5 55 AD DB BA FD D3 EA DE CB 16'π    'B8 B5 9B 6B D5 54 55 35 D6 BB 25 2A AA B5 5B 6C'π    '89 11 46 4A EC A2 24 AA 94 94 96 A9 1B AA AA 5A'π    'B7 6F AB 7E BF BD B6 E9 42 4B 76 D6 AE A1 6A E6'π    'AD 64 CA D5 55 35 77 DB 22 45 A8 B5 15 04 41 00'π    '42 21 29 B7 F5 55 55 D5 AE D5 7E AB F6 EB 6D 56'π    '94 BE DB 7D B5 4A 55 9D 52 DB 35 2A AA AA AD 74'π    '88 0A D5 4A EC 50 88 2A 98 CA 57 6A 46 AA AA 57'π    '7D BF D5 F6 AD 7E D2 A9 A5 55 B6 CA 6A A2 D5 69'π    'BD A6 D6 D5 55 55 7F DA 21 51 42 B5 1A 02 11 42'π    '23 12 AA AD BD 5B 55 AA DB 55 7F 5D DB EB AF 56'π    '48 AB 6D BB D5 2C 2B 57 57 5D A8 95 4A A5 AB 74'π    '8A 05 D5 4A F4 A4 42 14 C8 45 55 52 C9 A4 B5 5E'π    'B6 FF D5 F7 76 BE B5 69 92 BE DB 56 AA C2 D6 DA'π    'B4 6A 37 6A B5 5A 5F A9 20 AA A2 B5 28 08 84 22'π    '15 9A B6 EF 36 5B 4A A9 ED 55 BE AA DD EB 6A 96'π    '25 6B B6 F5 55 15 6D 55 63 D5 E9 55 4A A5 B6 F4'π    '4A 01 C9 56 D2 A1 10 48 A4 25 4D 54 D5 B6 BB 57'π    '5B FF 75 EF B7 BE CD 69 4A DA 6D AD AA AA 92 AA'π    'DD 2B 56 AA B5 55 4F D1 10 AB B4 A9 54 04 24 8B'π    '49 5A BA AB 6D 65 44 AA EE AA EF 5A ED 75 B5 96'π    '15 B7 DB 55 55 55 6D 5D A2 D6 AA D5 4A AA B6 A4'π    '4A 01 41 56 A9 48 81 10 13 25 55 DD 92 9A BB 6F'π    'BB FF DA EF B7 E6 56 68 AB 6D 76 5A AA 85 D5 63'π    '5D 6D 55 5A B6 A5 2D EA A0 AA D5 29 42 11 14 25'π    '54 5A AA AA 6D 6A CA A9 6E B5 B5 BB 5D 5D D9 95'π    '12 DB 4D EB 55 5A AA DE 6D A9 BA A5 6A D2 CB 58'π    '0A 01 AB 56 99 42 21 49 2A A6 B3 55 D5 AB 35 5F'π    'DD EF 5F 6E F7 EA 97 6A 2D B5 FA 54 AA A5 56 A9'π    'D3 57 55 DA D5 2D 35 E2 A0 AA C4 A9 64 08 44 12'π    '52 59 4E D6 9B 4C D6 B2 BA BA F5 DD 6E B5 74 A8'π    '53 6F 2B AA AA 95 AD 56 95 6C B6 AA AA D2 D7 54'π    '0A 01 AB 64 D1 51 09 45 14 A6 B5 2D 6A BB A9 6F'π    'F7 D7 AF 7B DD 55 AB 22 AE DA EC D5 55 AA B2 D9'π    '7A D3 65 55 56 AD 2A D1 50 96 CA 49 8A 02 50 08'π    'A5 59 6A D9 55 54 56 DB AD 7A FA D5 7B EE 56 D4'π    '55 B5 AB 29 6A 56 4D 37 A5 AD 5D 5B A9 4A D5 AA'π    '02 21 95 92 20 54 02 B2 2A A7 55 56 D5 AB AA B7'π    '7B EF AF BF EE B5 D5 21 2B 6F 55 D2 95 AD B2 C9'π    '5A 56 D2 EA 76 B5 56 58 54 85 6A 49 44 81 54 84'π    'AA 58 AA B5 AA B5 6D DE FF DD 7B 6A DD AA 2A 4A'π    '56 DA AE 29 6A A9 6D B7 6D E9 6D 55 8D CA A9 A2'π    '80 09 97 22 29 2A 00 29 55 A7 56 CA 57 4A 9B 6D'π    'EE BB D6 BF BB 6D DA 91 5B AD 59 D3 5B 56 93 5A'π    '52 96 9B DB 79 3D 56 A8 29 52 E8 56 82 40 A9 55'π    '2A 5A B5 35 AC BB 76 BB DD EF 7E F5 76 AA 35 24'π    'B6 FB B6 04 A4 AA 6C A5 DF 6D 6A 2A A6 D2 AD 52'π    '82 05 AA 80 28 A9 02 28 55 A4 AA EA DB 56 AD D7'π    'BB BE AD AF ED 5B EA 4D 2D 95 54 AB 5B 55 53 5A'π    '95 6D DB 4D 5B 57 9A AA 22 0A D2 24 A0 81 48 57'π    '95 2D 4A D6 9B 57 76 DF F7 BB 5F 7F B6 EA 55 24'π    '15 A9 32 65 35 5A AE B7 76 D6 AD B9 6A A8 65 51'π    '44 51 54 89 0A 14 12 AC 32 AA B5 A9 75 6C AD BB'π    '6F 7F FA D5 6D 55 B4 49 FF 76 C4 8A C9 A5 51 64'π    'AA A9 53 66 D6 D7 DE A4 08 84 E5 20 21 21 44 5B'π    '4A 52 AB 56 AA AB DB 57 FE EB 6F BF DA AB 4A AA'π    '2A AD 29 55 37 5A AE 9B 55 56 AE 99 95 2A 29 4A'π    'A1 11 C8 05 44 4A 11 6E A5 AD 4A AD 52 DA 36 FE'π    'ED DF FA EC B5 D6 B5 11 D6 EA E2 4A EA AB D1 6A'π    'AD AA D9 77 7A F5 D6 91 04 22 B5 50 2A 90 A4 DA'π    '9A 12 B5 59 6F A7 ED B7 DF BF 57 5B DB 2D 48 44'π    '3D 95 0C 95 15 54 2F 56 DA 56 A6 AA A7 46 3A A4'π    '48 85 C0 04 80 25 09 B5 42 ED 4B 56 D4 5D 5B 6D'π    'BA FA FD FE B6 DA B5 A9 EB 6A A1 2A EA AB D2 D5'π    '55 AD 5D D5 5A BD E5 49 11 10 AA A1 52 88 53 6B'π    'A9 12 B5 69 AB B6 B2 DF FF F7 DF 55 ED 35 64 0A'π    'B6 AD 14 95 55 56 AC 9A AA 5A AA AB 6A CA 5A 92'π    '42 23 C0 04 04 22 84 D6 44 AD 4B 57 5D 6B AF 7B'π    '77 AF 7A FD 5A EA 89 51 6D 59 65 2A 95 54 53 65'π    '55 F5 55 5C D6 B5 AE A4 94 44 95 09 51 48 2B AD'π    'AA 92 B6 AA 6B 4D 75 B7 EE FE F7 57 B3 55 72 4A'π    'CA B2 08 55 6A EB AE DA DB 0A BB 6B AD D6 D1 49'π    '40 89 C0 22 02 22 84 B5 49 2D 55 55 D4 76 AE EE'π    'DD BD ED FA EE AA 84 91 BB 64 A2 AA AD 16 51 25'π    'A4 F5 64 D5 59 2D 3E 93 15 11 0A 48 A4 84 1B DB'π    '52 52 AA AE 97 DD D9 BF FF EB BF 6F 54 D4 AA 4B'π    '54 C9 4C 95 52 ED 6E DB 5B 2A DB AA B6 DA E2 A4'π    '40 22 D0 02 09 29 26 2A A4 8D 56 D9 6C B3 6F 7D'π    'BB 7F 75 DA DB 55 A1 2A AB 92 11 35 6D 12 92 AA'π    'A6 D5 95 56 A9 B5 9D 49 2A 85 02 50 52 42 49 D6'π    'A9 32 55 56 DB 6E B5 EB F7 DB EF 77 AA AA 0A 4A'π    'AD 24 A4 C2 92 ED 6D 55 5A AB 6A B9 D7 56 6A 92'π    '80 10 A4 02 85 14 96 BA D2 4D AA A9 A5 55 DB 5F'π    'BE FF 7A DD 55 49 52 9D 5A 49 4A 15 6D 12 55 AA'π    'B5 5A AD 67 3A AD D5 54 54 45 08 A4 10 22 2D 55'π    'A8 B2 5B 57 5E EE AE FF 77 AA EF B6 AA B2 54 35'π    '54 92 24 AA 92 AD AA 56 A5 55 52 DA D5 6A 9A A2'π    '80 90 52 00 A5 48 91 AA A5 8D A4 AD 69 5B 7B B5'π    'ED FF DA ED D5 44 81 6A A9 24 89 55 6D 5A D5 A9'π    '5A AA AD 55 B5 95 75 49 29 02 80 02 08 15 2F 6A'π    'A8 22 5B 5A 96 AC D2 EF BF AD B7 BA 8A A9 2A AD'π    '52 49 52 95 55 53 2A 56 A5 75 55 B6 AB 7D A5 54'π    '42 28 14 54 51 20 52 95 B5 5D B6 B5 7B 77 AF BF'π    '7B 7B 6D 6B 55 22 49 5A AC 92 14 2B AA AC D5 A9'π    '5A 8A AA 55 6A A3 5A 92 88 41 20 80 82 4A AD 6B'π    '61 25 25 65 94 AD 5B 7A F7 EF FF DE AA 89 12 B5'π    '51 24 A2 D4 55 53 55 57 6B 75 55 EA D7 5E A6 A4'π    '52 92 40 01 14 92 55 56 BA 5A DA 9B 6B DB B6 F7'π    'EF 7A BA B5 55 24 69 55 24 49 49 2B AA A6 AA A8'π    '94 AA AD 17 AC B5 59 49 80 00 85 14 21 24 AA AD'π    '6A AA AB 76 AD 36 6D EF DE EF F7 ED 52 49 82 BB'π    '59 93 12 54 AA AD 55 57 6B 55 5A EC 5B 6A B7 54'π    '55 55 08 20 8A 49 55 69 54 55 56 A5 5A ED DB DE'π    'BB DE AE DA AC 94 2A A4 42 24 66 AB 55 5A AB 59'π    '54 A5 55 5B B4 DD 69 51 00 00 10 81 10 92 AA D6'π    'ED 6A AD 5D 75 9B 6F BD FF 75 FD AA A1 21 49 7A'π    '95 49 09 6A AD 55 54 A6 AB 5A AA A5 6B AA D6 AA'π    '52 52 21 04 25 25 55 A9 99 15 B2 EA C6 76 DB 7B'π    'EA FF 5B 5A AA 8A 92 A5 28 12 AA 95 52 AA D7 5A'π    'D4 B5 55 5E B5 55 A9 54 C4 84 84 09 49 4A AB 57'π    '6E 6A 6D 95 BD DD B6 EF 5F ED F6 F5 58 22 25 5A'π    '42 B5 55 76 AD 55 A8 B5 2B 6A AA E9 EE B5 57 55'π    '11 20 20 10 12 15 56 AA BA 95 D6 6B 52 53 6B FB'π    'FD DB 5D AA C2 8C 8A EA 99 4A A5 89 55 5A 57 6A'π    'D5 55 55 57 5A AB 59 54 44 45 01 25 44 AA AD 6D'π    '55 76 99 DE AD BE DD DF 6B 7F F7 6D 14 51 35 50'π    '42 B5 5A 76 AA A5 A9 55 36 AA AA AA D5 D6 B6 D5'π    '91 08 44 00 11 25 5A 95 AE 89 77 28 B6 6B B7 B7'π    'FF D6 DC D2 D1 04 45 55 15 4A A5 95 55 5B 56 AA'π    'E9 55 56 DD BB 2D 6B 2A 24 51 08 2A A4 4A B5 6A'π    'B5 76 CA D7 69 DA 6D 7E AE FD AB AD 04 52 D5 69'π    '6A B5 5B 6A B6 AA AA D5 56 D6 AA A2 D6 FA D4 D4'π    '89 04 00 80 09 95 2A AB 65 8D B5 5A D6 A7 DB ED'π    'FD 57 7E D5 51 04 0A C2 15 4A A4 95 55 55 55 2A'π    'AA 99 55 5F AD 8B 5B 55 22 10 21 2A A2 2A D5 56'π    '9E 77 56 B5 2D 5D 76 FF FB FD D5 2A 82 29 AA 95'π    '6A B5 5B 6A AA B5 AA D5 55 66 AA A5 5B 7A AA AA'π    '48 40 44 00 09 55 56 ED 71 DD 6D 6A F5 AA AD DB'π    'AE AA BA D4 24 4A 2A A4 95 4A AA 96 D5 4A 55 AA'π    'AA 9A B5 5A B6 A6 D5 54 92 84 80 55 52 55 B9 2A'π    'AF 57 5A D5 8A B5 EB BF 7D FF EF 55 4A 91 4A 89'π    '6A B5 55 6D 2D B5 56 55 6A B5 4A A5 CD 5D 56 AB'π    '44 08 04 80 04 AB 46 D5 52 BA F5 AB 7B 4B 5F 7B'π    'DA AB 5A AA 10 24 2A B2 95 4A B7 5A DA 4B A9 AA'π    'D5 6A B5 5B 7B B9 AD 52 11 20 89 15 29 5A BD AA'π    'ED 6F AB 54 A6 B6 B6 F7 7F FE F5 55 45 49 55 04'π    '6A B5 A8 A5 55 B6 56 AD AA D5 6A AA 95 67 5A AD'π    'A4 09 10 20 42 A5 51 56 95 59 7E AF 59 55 6D EE'π    'FB AB A6 A8 28 12 55 52 95 4B 57 5A AA AD'πENDπππOBJECT BITMAP πBEGINπ    '42 4D 26 05 00 00 00 00 00 00 76 00 00 00 28 00'π    '00 00 28 00 00 00 3C 00 00 00 01 00 04 00 00 00'π    '00 00 B0 04 00 00 00 00 00 00 00 00 00 00 00 00'π    '00 00 00 00 00 00 00 00 00 00 00 00 BF 00 00 BF'π    '00 00 00 BF BF 00 BF 00 00 00 BF 00 BF 00 BF BF'π    '00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'π    '00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'π    '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00'π    '00 00 00 00 00 00 00 00 00 00 0B BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB B0 0B BB BB BB BB 00 00 BB BB BB BB BB BB BB'π    'BB BB BB BB BB B0 0B BB BB BB B0 00 00 0B BB BB'π    'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB 00 00'π    '00 00 BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'π    'BB B0 00 00 00 00 0B BB BB BB BB BB BB BB BB BB'π    'BB B0 0B BB BB B0 00 00 00 00 0B BB BB BB BB BB'π    'BB BB BB BB BB B0 0B BB BB B0 00 00 00 00 0B BB'π    'BB BB BB BB BB BB BB BB BB B0 0B BB BB B0 00 00'π    '00 00 0B BB BB BB BB BB BB BB BB BB BB B0 0B BB'π    'BB BB 00 00 00 00 BB BB BB BB BB BB BB BB BB BB'π    'BB B0 0B BB BB BB B0 00 00 0B BB BB BB BB BB BB'π    'BB BB BB BB BB B0 0B BB BB BB BB 00 00 BB BB BB'π    'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'π    'BB BB BB 00 00 BB BB BB BB BB BB BB BB B0 0B BB'π    'BB BB BB BB BB BB B0 00 00 0B BB BB BB BB BB BB'π    'BB B0 0B BB BB BB BB BB BB BB 00 00 00 00 BB BB'π    'BB BB BB BB BB B0 0B BB BB BB BB BB BB B0 00 00'π    '00 00 0B BB BB BB BB BB BB B0 0B BB BB BB BB BB'π    'BB B0 00 00 00 00 0B BB BB BB BB BB BB B0 0B BB'π    'BB BB BB BB BB B0 00 00 00 00 0B BB BB BB BB BB'π    'BB B0 0B BB BB BB BB BB BB B0 00 00 00 00 0B BB'π    'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB 00 00'π    '00 00 BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'π    'BB BB B0 00 00 0B BB BB BB BB BB BB BB B0 0B BB'π    'BB BB BB BB BB BB BB 00 00 BB BB BB BB BB BB BB'π    'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB 00'π    '00 BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'π    'BB BB B0 00 00 0B BB BB BB B0 0B BB BB BB BB BB'π    'BB BB BB BB BB BB 00 00 00 00 BB BB BB B0 0B BB'π    'BB BB BB BB BB BB BB BB BB B0 00 00 00 00 0B BB'π    'BB B0 0B BB BB BB BB BB BB BB BB BB BB B0 00 00'π    '00 00 0B BB BB B0 0B BB BB BB BB BB BB BB BB BB'π    'BB B0 00 00 00 00 0B BB BB B0 0B BB BB BB BB BB'π    'BB BB BB BB BB B0 00 00 00 00 0B BB BB B0 0B BB'π    'BB BB BB BB BB BB BB BB BB BB 00 00 00 00 BB BB'π    'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB B0 00'π    '00 0B BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'π    'BB BB BB 00 00 BB BB BB BB B0 0B BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'π    'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'π    'BB B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00'π    '00 00 00 00 00 00'πENDπππMAIN MENU πBEGINπ    MENUITEM "&About...", 102π    MENUITEM "Draw Image", 101πENDπππABOUT DIALOG 41, 33, 146, 132πSTYLE DS_LOCALEDIT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENUπCAPTION "About"πFONT 8, "Helv"πBEGINπ    CONTROL "Bitmap Dragging Sample", -1, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE, 0, 6, 144, 8π    CONTROL "Purpose: Demonstrates smooth bitmap dragging.  Select ""Draw Image"" to draw the domino, then drag it around using the mouse.", 103, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 19, 136, 42π    CONTROL "Written by: Michael Vincze", 101, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 65, 146, 9π    CONTROL "Adapted from: Patrick Schreier of", -1, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE, 2, 75, 144, 8π    CONTROL "Microsoft Windows Developer Support", -1, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE, 2, 85, 144, 8π    CONTROL "Copyright \251 1993 Vincze International", 102, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 95, 146, 8π    CONTROL "Portions Copyright \251 1992 Microsoft Corp.", 102, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 105, 146, 8π    CONTROL "OK", 1, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 57, 115, 32, 14πENDπππAPPLICATION ICON πBEGINπ    '00 00 01 00 01 00 20 20 10 00 00 00 00 00 E8 02'π    '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'π    '00 00 01 00 04 00 00 00 00 00 00 02 00 00 00 00'π    '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'π    '00 00 00 00 BF 00 00 BF 00 00 00 BF BF 00 BF 00'π    '00 00 BF 00 BF 00 BF BF 00 00 C0 C0 C0 00 80 80'π    '80 00 00 00 FF 00 00 FF 00 00 00 FF FF 00 FF 00'π    '00 00 FF 00 FF 00 FF FF 00 00 FF FF FF 00 00 00'π    '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'π    'BB BB BB BB BB BB BB BB BB BB 00 00 00 00 00 00'π    'BB 30 00 0B BB BB BB BB BB BB 03 00 00 00 00 00'π    'B3 00 00 00 BB BB BB BB BB BB 03 30 00 00 00 00'π    'B3 00 00 00 BB BB BB BB BB BB 03 33 00 00 00 00'π    'B3 00 00 00 BB BB BB BB BB BB 03 33 00 00 00 00'π    'B3 00 00 00 BB BB BB BB BB BB 03 33 00 00 00 00'π    'BB 30 00 03 BB BB BB BB BB BB 03 33 00 00 00 00'π    'BB B3 33 3B BB BB BB BB BB BB 03 33 00 00 00 00'π    'BB BB BB BB BB BB BB BB BB BB 03 33 00 00 00 00'π    'BB BB BB BB BB BB BB BB BB BB 03 33 00 00 00 00'π    'BB BB BB B3 00 00 BB BB BB BB 03 33 00 00 00 00'π    'BB BB BB 30 00 00 0B BB BB BB 03 33 00 00 00 00'π    'BB BB BB 30 00 00 0B BB BB BB 03 33 00 00 00 00'π    'BB BB BB 30 00 00 0B BB BB BB 03 33 00 00 00 00'π    'BB BB BB 30 00 00 0B BB BB BB 03 33 00 00 00 00'π    'BB BB BB B3 00 00 3B BB BB BB 03 33 00 00 00 00'π    'BB BB BB BB 33 33 BB BB BB BB 03 33 00 00 00 00'π    'BB BB BB BB BB BB BB BB BB BB 03 33 00 00 00 00'π    'BB BB BB BB BB BB BB BB BB BB 03 33 00 00 00 00'π    'BB BB BB BB BB BB 30 00 0B BB 03 33 00 00 00 00'π    'BB BB BB BB BB B3 00 00 00 BB 03 33 00 00 00 00'π    'BB BB BB BB BB B3 00 00 00 BB 03 33 00 00 00 00'π    'BB BB BB BB BB B3 00 00 00 BB 03 33 00 00 00 00'π    'BB BB BB BB BB B3 00 00 00 BB 03 33 00 00 00 00'π    'BB BB BB BB BB BB 30 00 03 BB 03 33 00 00 00 00'π    'BB BB BB BB BB BB B3 33 3B BB 03 33 00 00 00 00'π    '00 00 00 00 00 00 00 00 00 00 03 33 00 00 00 00'π    '0B BB BB BB BB BB BB BB BB BB B0 33 00 00 00 00'π    '00 BB BB BB BB BB BB BB BB BB BB 03 00 00 00 00'π    '00 0B BB BB BB BB BB BB BB BB BB B0 00 00 00 00'π    '00 00 00 00 00 00 00 00 00 00 00 00 00 00 E0 00'π    '00 7F E0 00 00 3F E0 00 00 1F E0 00 00 0F E0 00'π    '00 07 E0 00 00 07 E0 00 00 07 E0 00 00 07 E0 00'π    '00 07 E0 00 00 07 E0 00 00 07 E0 00 00 07 E0 00'π    '00 07 E0 00 00 07 E0 00 00 07 E0 00 00 07 E0 00'π    '00 07 E0 00 00 07 E0 00 00 07 E0 00 00 07 E0 00'π    '00 07 E0 00 00 07 E0 00 00 07 E0 00 00 07 E0 00'π    '00 07 E0 00 00 07 E0 00 00 07 E0 00 00 07 F0 00'π    '00 07 F8 00 00 07 FC 00 00 07 FE 00 00 07'πENDπππ---------- CUT HERE ---------- ABSTRACT.TXT ---------- π                                                                                              12     11-26-9317:06ALL                      MICHAEL VINCZE           Windows File Copy        IMPORT              12     Kxµ₧ π{πWINDOWS File CopyπMichael Vinczeπmav@asd470.dseg.ti.comπ}ππusesπ  WinTypes,π  WinProcs,π  Objects;ππconstπ  BufStreamSize = $400;ππvarπ  InBufStream : TBufStream;π  OutBufStream: TBufStream;π  C           : Byte;ππprocedure Gasp;πvarπ  Msg: TMsg;πbeginπwhile PeekMessage (Msg, 0, 0, 0, pm_Remove) doπ  with Msg doπ    if (Message < wm_KeyFirst) or (Message > wm_MouseLast) orπ       ((Message > wm_KeyLast) and (Message < wm_MouseFirst)) thenπ      beginπ      TranslateMessage (Msg);π      DispatchMessage (Msg);π      end;πend;ππ{ function copies one file to the other.  The return codeπ  is the same as the TBufStream return codes.  The Gaspπ  procedure is inserted to yield for other applicationsπ  during a copy.π}πfunction MyCopy (InFileName, OutFileName: PChar): Word;πbeginπInBufStream.Init (InFileName, stOpenRead, BufStreamSize);πif InBufStream.Status <> stOk thenπ  beginπ  MyCopy := InBufStream.Status;π  endπelseπ  beginπ  OutBufStream.Init (OutFileName, stCreate, BufStreamSize);π  if OutBufStream.Status <> stOk thenπ    beginπ    MyCopy := OutBufStream.Status;π    endπ  elseπ    beginπ    InBufStream.Read (C, 1);π    while InBufStream.Status = stOk doπ      beginπ      Gasp;π      OutBufStream.Write (C, 1);π      InBufStream.Read (C, 1);π      end;π    end;π  end;πInBufStream.Done;πOutBufStream.Done;πend;π                                                                              13     11-26-9317:49ALL                      FRANK YOUNG              Booting under Windows    IMPORT              16     Kx⌠ {πRebooting in itself is rather easy to do...call the right interrupt withπthe right values and you go it--most of the time.  I'd noticed that anyπreboot I tried to do from my program under windows would fail.  I'm not aπwindows programmer and seldom use it, but I do have one program that needsπto be able to call this routine under certain conditions.  A clean rebootπis favored to a lock up or data corruption.  I searched for pascal sourceπto work under win, but found none.  I finally ran into a short .com fileπwhich did in fact work.  I ran the code through a .com to pas inlineπconversion utility and ended up with pages of ugly code.  I finally gotπaround to converting it into inline assembly code which shortened things upπsubstantially (10 pages or so-the inline tranlsation was bad, loops wereπiterative/non existant).  I then killed the code not necessary for pascal,πand this is what I ended up with:π}ππUNIT BOOTSYS;π(* Unit for unconditional reboot (TESTED UNDER DOS 5/6 & WIN 3.0/3.1) *)π(* (C) Copyright 1993 Frank Young, all rights reserved *)πINTERFACEπ πPROCEDURE REBOOT;ππIMPLEMENTATIONπProcedure Reboot; Assembler;πASMπ  MOV AX,CSπ  MOV DS,AXπ  MOV ES,AXπ  MOV SS,AXπ  MOV SP,030Dhπ  MOV BYTE PTR [00FFh],00π@LOOP1:π  CALL @LOOP3π  MOV AH,4Chπ  INT 21hπ  JMP @LOOP1π  MOV CX,250π@LOOP2:π  ADD [BX+SI],ALπ  LOOP @LOOP2π  ADD DL,BHπ@LOOP3:π  MOV AX,0040hπ  MOV DS,AXπ  MOV BX,0072hπ  MOV WORD PTR [BX],1234hπ@LOOP4:π  IN AL,64hπ  TEST AL,02hπ  JNZ @LOOP4π  MOV AL,0D1hπ  OUT 64,ALπ  XOR AL,ALπ  OUT 64,ALπ  STIπ  MOV CX,0003hπ@LOOP5:π  MOV AX,[$006C]π@LOOP6:π  CMP AX,[$006C]π  JZ @LOOP6πLOOP @LOOP5π  CLIπ  IN AL,60hπ  XOR AX,AXπ  MOV DS,AXπ  MOV ES,AXπ  MOV SS,AXπ  MOV SP,AXπ  MOV AX,0062hπ  CLIπ  PUSH AXπ  MOV AX,$F000π  PUSH AXπ  MOV AX,$FFF0π  PUSH AXπ  XOR AX,AXπ  IRETπend;π πend.π                                                                                                            14     11-26-9317:49ALL                      STEVE WILLER             Windows 3-D frames       IMPORT              72     KxiK { Frames unit - a set of comprehensive (for my purposes) functions forπ    drawing pretty 3-D frames of all types. Pretty simple stuff - I'm sureπ    you will be able to figure it out - but that's why I included it.π    As always, you are welcome to do whatever with this unit. I only ask thatπ    if you upload it somewhere modified, keep my name off it, so I don't haveπ    to answer for your bad code <grin>. If you have any suggestions orπ    questions, by all means send them to me - I'd love to hear from a fellowπ    programmer.π        Steve Willerπ        Mark Data Managementπ        CIS: 70400,3667π        AOL: SteveWillπ}ππunit frames;ππinterfaceπuses WinTypes,WinProcs,WinDOS;πprocedure DrawBorderFrame(PaintDC:HDC;PaintR:TRect;Back:boolean);πprocedure DrawOutFrame(PaintDC:HDC;PaintR:TRect;Back:boolean;Width:integer);πprocedure DrawInFrame(PaintDC:HDC;PaintR:TRect;Back:boolean;Width:integer);πprocedure DrawDivLine(PaintDC:HDC;Y:integer;Width:integer);πprocedure DrawDotLine(PaintDC:HDC;PaintR:TRect;Incr:integer);πfunction MakeBorBrush(HWindow:HWnd;BackColor1,BackColor2:TColorRef):HBrush;πprocedure DrawExplodeFrame(PaintDC:HDC;ExplR:TRect;PenColor,BrushColor:TColorRef;DrawBrush:boolean;Width:integer;π                Steps:integer;Pause:longint);ππimplementationπprocedure DrawBorderFrame(PaintDC:HDC;PaintR:TRect;Back:boolean);πvar ThePen,OldPen:HPen;π        FillBrush,OldBrush:HBrush;πbeginπ    if Back thenπ    beginπ        FillBrush := CreateSolidBrush($00C0C0C0);π        OldBrush := SelectObject(PaintDC,FillBrush);π        InflateRect(PaintR,-1,-1);π        FillRect(PaintDC,PaintR,FillBrush);π        InflateRect(PaintR,1,1);π        SelectObject(PaintDC,OldBrush);π        DeleteObject(FillBrush);π    end;ππ    OldBrush := SelectObject(PaintDC,GetStockObject(Null_Brush));π    ThePen := CreatePen(ps_Solid,1,$00C0C0C0);π    OldPen := SelectObject(PaintDC,ThePen);π    PaintR.top:=PaintR.top+1;π    PaintR.left:=PaintR.left-1;π    Rectangle(PaintDC,PaintR.left,PaintR.top,PaintR.right,PaintR.bottom);π    PaintR.top:=PaintR.top-1;π    PaintR.left:=PaintR.left+1;π    SelectObject(PaintDC,OldPen);π    DeleteObject(ThePen);π    SelectObject(PaintDC,OldBrush);ππ    ThePen := CreatePen(ps_Solid,1,RGB(255,255,255));π    OldPen := SelectObject(PaintDC,ThePen);π    MoveTo(PaintDC,PaintR.right,PaintR.top);π    LineTo(PaintDC,PaintR.left,PaintR.top);π    LineTo(PaintDC,PaintR.left,PaintR.bottom);π    MoveTo(PaintDC,PaintR.left+2,PaintR.bottom-2);π    LineTo(PaintDC,PaintR.right-2,PaintR.bottom-2);π    LineTo(PaintDC,PaintR.right-2,PaintR.top+2);π    SelectObject(PaintDC,OldPen);π    DeleteObject(ThePen);ππ    ThePen := CreatePen(ps_Solid,1,RGB(127,127,127));π    OldPen := SelectObject(PaintDC,ThePen);π    MoveTo(PaintDC,PaintR.right-2,PaintR.top+2);π    LineTo(PaintDC,PaintR.left+2,PaintR.top+2);π    LineTo(PaintDC,PaintR.left+2,PaintR.bottom-3);π    MoveTo(PaintDC,PaintR.left,PaintR.bottom);π    LineTo(PaintDC,PaintR.right,PaintR.bottom);π    LineTo(PaintDC,PaintR.right,PaintR.top);π    SelectObject(PaintDC,OldPen);π    DeleteObject(ThePen);πend;ππprocedure DrawOutFrame (PaintDC:HDC; PaintR:TRect; Back:boolean; Width:integer);πvarπ    ThePen, OldPen:HPen;π    FillBrush, OldBrush:HBrush;π    count:integer;π    CalcR:TRect;πbeginπif Back thenπ    beginπ    FillBrush := CreateSolidBrush ($00C0C0C0);π    OldBrush := SelectObject(PaintDC,FillBrush);π    InflateRect (PaintR, -1*(Width)+1, -1*(Width)+1);π    FillRect (PaintDC,PaintR,FillBrush);π    InflateRect (PaintR,Width-1,Width-1);π    SelectObject (PaintDC,OldBrush);π    DeleteObject (FillBrush);π    end;ππCalcR := PaintR;ππfor count:=0 to (Width-1) doπ    beginπ    PaintR := CalcR;π    InflateRect (PaintR, -1*(count), -1*(count));ππ    ThePen := CreatePen(ps_Solid,1,RGB(255,255,255));π    OldPen := SelectObject(PaintDC,ThePen);π    MoveTo (PaintDC,PaintR.right,PaintR.top);π    LineTo (PaintDC,PaintR.left,PaintR.top);π    LineTo (PaintDC,PaintR.left,PaintR.bottom+1);π    SelectObject (PaintDC,OldPen);π    DeleteObject (ThePen);ππ    ThePen := CreatePen (ps_Solid,1,RGB(127,127,127));π    OldPen := SelectObject (PaintDC,ThePen);π    MoveTo (PaintDC,PaintR.right,PaintR.top+1);π    LineTo (PaintDC,PaintR.right,PaintR.bottom);π    LineTo (PaintDC,PaintR.left,PaintR.bottom);π    SelectObject (PaintDC,OldPen);π    DeleteObject (ThePen);π    end;πend;ππprocedure DrawInFrame(PaintDC:HDC;PaintR:TRect;Back:boolean;Width:integer);πvar ThePen,OldPen:HPen;π        FillBrush,OldBrush:HBrush;π        count:integer;π        CalcR:TRect;πbeginπ    if Back thenπ    beginπ        FillBrush := CreateSolidBrush($00C0C0C0);π        OldBrush := SelectObject(PaintDC,FillBrush);π        InflateRect(PaintR,-1*(Width)+1,-1*(Width)+1);π        FillRect(PaintDC,PaintR,FillBrush);π        InflateRect(PaintR,Width-1,Width-1);π        SelectObject(PaintDC,OldBrush);π        DeleteObject(FillBrush);π    end;ππ    CalcR:=PaintR;ππ    for count:=0 to (Width-1) doπ    beginπ        PaintR:=CalcR;π        InflateRect(PaintR,-1*(count),-1*(count));ππ        ThePen := CreatePen(ps_Solid,1,RGB(127,127,127));π        OldPen := SelectObject(PaintDC,ThePen);π        MoveTo(PaintDC,PaintR.right,PaintR.top);π        LineTo(PaintDC,PaintR.left,PaintR.top);π        LineTo(PaintDC,PaintR.left,PaintR.bottom);π        SelectObject(PaintDC,OldPen);π        DeleteObject(ThePen);ππ        ThePen := CreatePen(ps_Solid,1,RGB(255,255,255));π        OldPen := SelectObject(PaintDC,ThePen);π        MoveTo(PaintDC,PaintR.right,PaintR.top+1);π        LineTo(PaintDC,PaintR.right,PaintR.bottom);π        LineTo(PaintDC,PaintR.left-1,PaintR.bottom);π        SelectObject(PaintDC,OldPen);π        DeleteObject(ThePen);π    end;πend;ππprocedure DrawDivLine(PaintDC:HDC;Y:integer;Width:integer);πvar ThePen,OldPen:HPen;π        FillBrush,OldBrush:HBrush;π        count:integer;πbeginπ        ThePen := CreatePen(ps_Solid,Width,RGB(127,127,127));π        OldPen := SelectObject(PaintDC,ThePen);π        MoveTo(PaintDC,GetSystemMetrics(sm_CXScreen),Y);π        LineTo(PaintDC,0,Y);π        SelectObject(PaintDC,OldPen);π        DeleteObject(ThePen);π        Y:=Y+Width;π        ThePen := CreatePen(ps_Solid,Width,RGB(255,255,255));π        OldPen := SelectObject(PaintDC,ThePen);π        MoveTo(PaintDC,GetSystemMetrics(sm_CXScreen),Y);π        LineTo(PaintDC,0,Y);π        SelectObject(PaintDC,OldPen);π        DeleteObject(ThePen);πend;ππprocedure DrawDotLine(PaintDC:HDC;PaintR:TRect;Incr:integer);πvar ROP2:integer;π        count:integer;πbeginπ    ROP2 := GetROP2(PaintDC);π    SetROP2(PaintDC,r2_Not);π    count := PaintR.left;π    while count < PaintR.right-1 doπ        beginπ            SetPixel(PaintDC,count,PaintR.top,$00000000);π            SetPixel(PaintDC,count,PaintR.bottom-1,$00000000);π            count := count + Incr;π        end;π    count := PaintR.top+2;π    while count < PaintR.bottom-1 doπ        beginπ            SetPixel(PaintDC,PaintR.left,count,$00000000);π            SetPixel(PaintDC,PaintR.right-1,count,$00000000);π            count := count + Incr;π        end;π    SetROP2(PaintDC,ROP2);πend;πππfunction MakeBorBrush(HWindow:HWnd;BackColor1,BackColor2:TColorRef):HBrush;πvar DC,MemDC:HDC;π        Bits:HBitmap;π        FillR:TRect;π        TheBrush,OldBrush:HBrush;πbeginπ    DC:=CreateDC('display',nil,nil,nil);π    MemDC:=CreateCompatibleDC(DC);π    Bits:=CreateCompatibleBitmap(DC,8,8);π    SelectObject(MemDC,Bits);π    if Bits<>0 thenπ    beginπ        TheBrush:=CreateSolidBrush(GetNearestColor(DC,BackColor2));π        OldBrush:=SelectObject(MemDC,TheBrush);π        PatBlt(MemDC,0,0,8,8,Blackness);π        with FillR do beginπ            left:=0;right:=8;top:=0;bottom:=8;π        end;π        FillRect(MemDC,FillR,TheBrush);π        SelectObject(MemDC,OldBrush);π        DeleteObject(TheBrush);π        SetPixel(MemDC,0,0,BackColor1);π        SetPixel(MemDC,0,2,BackColor1);π        SetPixel(MemDC,0,4,BackColor1);π        SetPixel(MemDC,0,6,BackColor1);π        SetPixel(MemDC,2,0,BackColor1);π        SetPixel(MemDC,2,2,BackColor1);π        SetPixel(MemDC,2,4,BackColor1);π        SetPixel(MemDC,2,6,BackColor1);π        SetPixel(MemDC,4,0,BackColor1);π        SetPixel(MemDC,4,2,BackColor1);π        SetPixel(MemDC,4,4,BackColor1);π        SetPixel(MemDC,4,6,BackColor1);π        SetPixel(MemDC,6,0,BackColor1);π        SetPixel(MemDC,6,2,BackColor1);π        SetPixel(MemDC,6,4,BackColor1);π        SetPixel(MemDC,6,6,BackColor1);π        MakeBorBrush:=CreatePatternBrush(Bits);π    end else MakeBorBrush:=0;π    DeleteDC(MemDC);π    DeleteDC(DC);π    DeleteObject(Bits);πend;ππprocedure DrawExplodeFrame(PaintDC:HDC;ExplR:TRect;PenColor,BrushColor:TColorRef;DrawBrush:boolean;Width:integer;π            Steps:integer;Pause:longint);πvar    count:integer;π        dX,dY:double;π        ThePen,OldPen:HPen;π        TheBrush,OldBrush:HBrush;π        OrigR:TRect;π        TimeCount:longint;πbeginπ    ThePen := CreatePen(ps_Dot,Width,PenColor);π    OldPen := SelectObject(PaintDC,ThePen);π    if DrawBrush thenπ        TheBrush:=CreateSolidBrush(BrushColor) elseπ        TheBrush := GetStockObject(Null_Brush);π    OldBrush:= SelectObject(PaintDC,TheBrush);π    dY:=(ExplR.bottom-ExplR.top)/Steps;π    dX:=(ExplR.right-ExplR.left)/Steps;π    with ExplR doπ    beginπ        left:=left+((right-left) div 2);π        top:=top+((bottom-top) div 2);π        right:=left;bottom:=top;π    end;π    OrigR:=ExplR;π    for count:=1 to steps doπ    beginπ        with ExplR doπ        beginπ            TimeCount := GetTickCount;π            left:=OrigR.left-integer(Round(dX*count));π            right:=OrigR.right+integer(Round(dX*count));π            bottom:=OrigR.bottom-integer(Round(dY*count));π            top:=OrigR.top+integer(Round(dY*count));π            Rectangle(PaintDC,left,top,right,bottom);π            while (GetTickCount - TimeCount) < Pause do begin end;π        end;π    end;π    SelectObject(PaintDC,OldBrush);π    DeleteObject(TheBrush);π    SelectObject(PaintDC,OldPen);π    DeleteObject(ThePen);πend;ππbeginπend.π                                                                                                                          15     01-27-9412:29ALL                      ELTON K TEKOLSTE         Towers of Hanoi          IMPORT              26     Kxlƒ {πI saw a postihg yesterday requesting source code for the Tower of Hanoiπproblem. This proplem is an old chestnut which we drag out to demonstrateπrecursion after we realize that factorial is really iteration.ππHere is source code done in TPW1.5.π}ππprogram TowersofHanoi;ππusesπ  CRT; { Not needed unless using Windows version }π       { copyright 1993 E. Kurt TeKolste }π       { no rights reserved }ππconstπ  Max = 20;  { Use all of this at your peril }π  A   = 'A';  { Names of the three towers }π  B   = 'B';π  C   = 'C';ππtypeπ  Stack = 1..Max;π  Disk  = 0..Max;ππ  Tower = objectπ    Depth : integer;  { the current number of disks on the tower }π    V : array[Stack] of Disk; { the sizes of the disks on the tower }ππ    constructor Init(N : integer); {creates a tower with disks 1..N }π    procedure Add(D : Disk);     { Adds a disk of size D on top }π    function  Remove : Disk;     { Removes the top disk and returns its size }π    procedure Print;   { Prints a tower }π  end;ππconstructor Tower.Init(N : integer);πvarπ  I : Disk;πbeginπ  Depth := N;π  for I := 1 to N  do V[I] := I;π  for I := succ(N) to Max do V[I] := 0;πend;ππprocedure Tower.Add(D : Disk);πbeginπ  Depth    := succ(Depth);π  V[Depth] := D;πend;ππfunction Tower.Remove : Disk;πbeginπ  Remove := V[Depth];π  Depth  := pred(Depth);πend;ππprocedure Tower.Print;πvarπ  I : Stack;πbeginπ  clreol;π  for I := 1 to Depth do write(V[I]:3);πend;ππtypeπ  Hanoi = objectπ    Display : boolean;  { If true, each move is displayed. }π    Pause   : boolean;  { If true, waits for keypress to continue afterπ                          each move. }π    S       : Stack;    { The number of disks on the towers.}π    H       : array[A..C] of Tower;ππ    constructor Init(I : Stack; On : boolean; Wait : boolean);π                { Creates a tower of Hanoi with I disks, the displayπ                  determined by On and the pause determined by Wait. }π    procedure Move( N : integer; var Source, Sink, Using : Tower);π                    { Moves the top N disks from Source to Sink using Using. }π    procedure Transfer;π                       { Moves all of the disks from A to C. }π    procedure Print;π                        { Prints the Towers of Hanoi }π  end;ππconstructor Hanoi.Init(I : Stack; On : boolean; Wait : boolean);πbeginπ  if I < Max then S := I else S := Max;π  Display := On;π  Pause   := Wait;π  H[A].Init(S);π  H[B].Init(0);π  H[C].Init(0);πend;ππprocedure Hanoi.Move(N : integer; var Source, Sink, Using : Tower);πvarπ  F : char;πbeginπ  if N > 0 thenπ  beginπ    Move(N-1, Source, Using, Sink);π    Sink.Add(Source.Remove);π    if Display thenπ    beginπ      Print;π      if Pause   thenπ      beginπ        repeat until keypressed;π        F := readkey;π      end;π    end;π    Move(N-1, Using, Sink, Source);π  end;πend;ππprocedure Hanoi.Print;πvarπ  X : A..C;πbeginπ  for X := A to C doπ  beginπ    gotoxy(1,ord(X) - Ord(A) + 1);π    H[X].Print;π  end;πend;ππprocedure Hanoi.Transfer;πbeginπ  Move(S, H[A], H[B], H[C]);πend;ππvarπ  T : Hanoi;πbeginπ  with T doπ  beginπ    Init(6,true,true);π    Transfer;π  end;πend.π                                                                                        16     01-27-9413:34ALL                      GREG ESTABROOKS          Detection for WIN 3.X    IMPORT              19     Kxiæ {***********************************************************************}πPROGRAM Win3XInf;       {  Simple Detection routines for Windows 3.X    }π            {  Last Updated April 28/93, Greg Estabrooks    }ππFUNCTION Win3X :BOOLEAN;  ASSEMBLER;π        {  Routine to determine if Windows is currently running }πASMπ  Mov AX,$4680                          {  Win 3.x Standard check       }π  Int $2F                               {  Call Int 2F                  }π  Cmp AX,0                              {  IF AX = 0 Win in real mode   }π  JNE @EnhancedCheck                    {  If not check for enhanced mode}π  Mov AL,1                              {  Set Result to true           }π  Jmp @Exit                             {  Go to end of routine         }π@EnhancedCheck:                         {  Else check for enhanced mode }π  Mov AX,$1600                          {  Win 3.x Enhanced check       }π  Int $2F                               {  Call Int 2F                  }π  Cmp AL,0                              {  Check returned value         }π  Je @False                             {  If not one of the below it   }π  Cmp AL,$80                            {  is NOT installed             }π  Je @Falseπ  Mov AL,1                              {  Nope it must BE INSTALLED    }π  Jmp @Exitπ@False:π  Mov AL,0                              {  Set Result to False          }π@Exit:πEND;{Win3X}ππFUNCTION WinVer :WORD;  ASSEMBLER;π        {  Returns a word containing the version of Win Running }π        {  Should only be used after checking for Win installed }π        {  Or value returned will be meaning less               }πASMπ  Mov AX,$1600                     {    Enhanced mode check             }π  Int $2F                          {    Call Int 2F                     }πEND;{WinVer}ππBEGINπ  IF Win3X THEN                         {  If it is running say so      }π   BEGINπ    Writeln('Windows is Running! ');    {  Now display version running  }π    Writeln('Version Running is : ',Lo(WinVer),'.',Hi(WinVer));π   ENDπ  ELSE                                  {  If not 'Just say NO!'        }π    Writeln('Windows is not Running!');πEND.π{***********************************************************************}π                                                                                                        17     02-03-9410:53ALL                      SWAG SUPPORT TEAM        Windows File Copy        IMPORT              23     Kxτ≡ Unit Fcopy;ππInterfaceππ{copy file: return TRUE is successful or FALSE if somethingπ went wrong}π Function COPYFILE(Source, Target : String) : Boolean;πππImplementationπusesπwintypes, winprocs, windos;πππ{--- buffer for file copy -------}πTypeπCopyBuf = Array[1..32768] of Byte;  {32kb buffer!}ππVarπBuffers : CopyBuf;                 {pointer for buffer}πππ{------------------ Print an Error Message -------------}πProcedure ErrorMessage(Title,Msg : PChar);πBeginπ  MessageBox(GetFocus,Msg,Title,mb_IconExclamation+mb_OK);πEnd;πππ{--------- copy from Source to Target ---------}πFunction COPYFILE(Source, Target : String) : Boolean;ππVarπSourceFile,TargetFile   : File;πBytesRead,πBytesWritten  : Integer;ππTotalRead,      {bytes from source file}πTotalWritten,   {bytes from target file}ππOldTime       : LongInt;πππBegin {CopyFile}ππ   CopyFile  := False;ππ   If Source = Target thenπ   beginπ     ErrorMessage(' ERROR ',' Same Source and Target files! ');π     exit;π   end;πππ   Assign(SourceFile,Source);ππ   {$I-}π   Reset(SourceFile,1);π   {$I+}ππ   if IORESULT <> 0 thenπ   beginπ     ErrorMessage(' ERROR ',' I am unable to open the source file');π     exit;π   end;πππ    Assign(TargetFile,Target);ππ    {$I-}π      Rewrite(TargetFile,1);π    {I+}ππ     if ioresult <> 0 thenπ      beginπ        ErrorMessage(' ERROR ',' I am unable to create the target file ');π        Close(SourceFile);π        EXIT;π      end;πππ      GetFTime(SourceFile,OldTime);  {* get the old time & date stamp *}ππ      New(Buffers);π      TotalRead    := 0;π      TotalWritten := 0;πππ     {$I-}π      While not Eof(SourceFile) doπ      beginπ         BlockRead(SourceFile,  Buffers, Sizeof(Buffers), BytesRead);π         BlockWrite(TargetFile, Buffers, BytesRead, BytesWritten);ππ         Inc(TotalRead,    BytesRead);    {monitor the total size}π         Inc(TotalWritten, BytesWritten); {of bytes being copied}π      end;π     {$I+}ππ     if ioresult <> 0 thenπ      beginπ        ErrorMessage(' ERROR ',' Error encountered during file copy ');π        Dispose(Buffers);ππ        {$I-}π        Close(SourceFile);π        Close(TargetFile);π        {$I+} If IoResult <> 0 Then {leave anyway};ππ        EXIT;π      end;πππ      {$I-}π        Close(SourceFile);π        SetFTime(TargetFile, OldTime);  {* reset the date and time *}π        Close(TargetFile);π      {$I+} If IoResult <> 0 Then {};πππ     Dispose(Buffers);ππ     If TotalRead <> TotalWrittenπ     Then {mismtach in bytes read and copied}π     beginπ       ErrorMessage('ERROR',π       ' Discrepancies exist in the source and target file sizes!');ππ       Exit;π     end;πππ     {if we get here, all went well}ππ     CopyFile := True;ππEnd; {copyfile}ππEnd.ππ                                                                                                        18     02-05-9412:59ALL                      THOMAS CARLISLE          Windows Statusline Unit  IMPORT              148    Kx   (**************************************************************************π *                                                                        *π * STATUS.PAS - A Statusline unit, by Thomas S. Carlisle                  *π *              Free for public use, all I ask is that my name remain     *π *              with this code.                                           *  π *                                                                        *π * This unit provides easy implementation of a status line. The           *π * statusline will be at the bottom of the screen, and will take on the   *π * colors defined in the system as button face, and button shadow.        *π *                                                                        *π * The statusline can have multiple partitions to display different       *π * information. For example, you could have a partition that displays     *π * a clock (see STATUSEX.PAS), another one that displays the current      *π * file open in a word processing application, or virtually anything you  *π * can think up.                                                          *π *                                                                        *π * The main object is TStatusLine. TStatusline is an abstract object with *π * limited default functionality. TStatusline is a statusline with no     *π * partitions. It knows how to draw itself, and most importantly it knows *π * how to insert partitions. However, TStatusline does not Insert any     *π * partitions. The user must create a descendant object of TStatusLine    *π * that overrides the Setup method to insert some partitions.             *π *                                                                        *π * A typical Setup method may look something like this:                   *π *  PROCEDURE TMyStatusline.Setup;                                        *π *  BEGIN                                                                 *π *       InsertItem(100,DrawProc);                                        *π *  END;                                                                  *π *                                                                        *π * That would insert a partition that is 100 pixels wide. The second      *π * parameter is important. It is a procedure. Each partition must be      *π * passed a procedure so it knows who to call to fill in the partition    *π * with the appropriate text. The procedure passed in the InsertItem      *π * statement MUST be a procedure that was previously declared like this:  *π *                                                                        *π * PROCEDURE DrawProc(PaintHDC : HDC; VAR PaintInfo : TPaintStruct);FAR;  *π * BEGIN                                                                  *π *     { your custom draw code goes here... }                             *π * END;                                                                   *π *                                                                        *π * Note proceduremust be declared as FAR. It also MUST have the exact     *π * parameter list as shown. In the body, you can do what you want. A      *π * simple example would be to simply write out a line of text:            *π *                                                                        *π * PROCEDURE DrawProc(PaintHDC : HDC; VAR PaintInfo : TPaintStruct);FAR;  *π * BEGIN                                                                  *π *     TextOut(PaintHdc,3,1,'Test',4);                                    *π * END;                                                                   *π *                                                                        *π * Usually you will not have a simple procedure like that. For a better,  *π * more functional example see the procedure Clock in STATUSEX.PAS        *π *                                                                        *π *************************************************************************)ππUNIT Status;ππINTERFACEππUSESπ    WObjects,WinTypes,WinProcs,WinCrt;ππTYPEπ    TPaintProc = PROCEDURE(PaintHdc : HDC; VAR PaintInfo : TPaintStruct);ππ    PPartitionCollection = ^TPartitionCollection;ππ    TPartitionCollection = OBJECT(TCollection)π    END;ππ    PPartition = ^TPartition;ππ    TPartition = OBJECT(TWindow)π        PRIVATEπ         LeftPosition,π         RightPosition  : WORD;π         PaintProc      : TPaintProc;π         CONSTRUCTOR Init(AParent : PWindowsObject; ATitle : PCHAR;π               LPos,RPos : WORD; Proc : TPaintProc);π         PROCEDURE Paint(PaintHDC : HDC; VAR PaintInfo : TPaintStruct);π              VIRTUAL;π    END;π    π    PStatusLine = ^TStatusLine;ππ    TStatusLine = OBJECT(TWindow)π        CONSTRUCTOR Init(AParent : PWindowsObject; ATitle : PCHAR);π        PROCEDURE Paint(PaintHDC : HDC; VAR PaintInfo : TPaintStruct);π              VIRTUAL;π        DESTRUCTOR Done;VIRTUAL;π        PROCEDURE InsertItem(StrLength : WORD; Proc : TPaintProc);π        PROCEDURE Setup;VIRTUAL;π        FUNCTION GetPartition(Index : BYTE):PPartition;VIRTUAL;π        PRIVATEπ         Partitions     : PPartitionCollection;        π    END;ππIMPLEMENTATIONππ(************************** TPartition Methods ***************************)ππ{ TPartition is an object descendant of TWindow. All TPartition objectsπ  are child windows with TStatusLine as the parent.ππ  When a TPartition is inserted in the statusline, it is automaticllyπ  inserted right next to the previous TPartition on the statusline.ππ  The Init constructor method is called whenevr a new TPartition isπ  inserted in the statusline. The parameters of Init include theπ  TPartition's parent window, its title (Nil), the TPartitions left positionπ  on the statusline, it's right position on the statusline, and mostπ  importantly -- the last parameter -- is a procedure parameter. Thisπ  procedure parameter is a user defined procedure that will be used byπ  the TPartition.Paint method.ππ  Each TPartition knows how to draw itself, with the Paint method. The Paintπ  method draws an empty partition (i.e - only the frame, not filled withπ  text. The paint method calls the user defined procedure, which isπ  responsible for filling the partition frame with the appropriate text.ππ  See STATUSEX.PAS for an example of the user defined procedure           }π    ππCONSTRUCTOR TPartition.Init(AParent : PWindowsObject; ATitle : PCHAR;π       LPos,RPos : WORD; Proc : TPaintProc);ππVARπ   R   : TRect;πBEGINπ     TWindow.Init(AParent,ATitle);π     LeftPosition:=LPos;π     RightPosition:=RPos;π     PaintProc:=Proc;π     WITH Attr DO BEGINπ          Style:=Style OR ws_Child;π          X:=LPos;π          Y:=0;π          W:=RPos-LPos;π          H:=17;π     END;πEND;ππPROCEDURE TPartition.Paint(PaintHDC : HDC; VAR PaintInfo : TPaintStruct);πVARπ   R : TRect;π   TheBrush,π   OldBrush     : HBrush;π   Pen,π   OldPen       : HPen;πBEGINπ     GetClientRect(HWindow,R);π     TheBrush:=CreateSolidBrush(GetSysColor(color_BtnFace));π     FillRect(PaintHdc,R,TheBrush);π     DeleteObject(TheBrush);ππ     SetBkColor(PaintHdc,GetSysColor(color_BtnFace));π     PaintProc(PaintHdc,PaintInfo);ππ     Pen:=CreatePen(ps_Solid,1,RGB(255,255,255));π     OldPen:=SelectObject(PaintHDC,Pen);π     MoveTo(PaintHDC,R.Left,R.Top);π     LineTo(PaintHDC,R.Right,R.Top);π     MoveTo(PaintHdc,R.Left,R.Top);π     LineTo(PaintHdc,R.Left,R.Bottom);π     MoveTo(PaintHdc,R.Left+2,R.Top+15);π     LineTo(PaintHdc,R.Right-3,R.Top+15);π     LineTo(PaintHdc,R.Right-3,R.Top+2);ππ     DeleteObject(SelectObject(PaintHdc,OldPen));π     Pen:=CreatePen(ps_Solid,1,GetSysColor(color_btnShadow));π     OldPen:=SelectObject(PaintHDC,Pen);π     MoveTo(PaintHdc,R.Left+2,R.Top+2);π     LineTo(PaintHdc,R.Right-3,R.Top+2);π     MoveTo(PaintHdc,R.Right-1,R.Top);π     LineTo(PaintHdc,R.Right-1,R.Bottom);π     MoveTo(PaintHdc,R.Left+2,R.Top+2);π     LineTo(PaintHdc,R.Left+2,R.Top+15);ππ     DeleteObject(SelectObject(PaintHDC,OldPen));     πEND;ππ(*************************** TStatusLine Methods *************************)ππ{ TStatusLine is an object descendant of TWindow. TStatusLine has a fieldπ  called Partitions, which is a collection of TPartitions.ππ  The InsertItem method is the method responsible for inserting newπ  TPartitions in the Partition collection.ππ  The Paint method draws the statusline, and iterates through the Partitionπ  collection call each ones Paint method. This results in the entireπ  statusline being redrawn. }πππCONSTRUCTOR TStatusLine.Init(AParent : PWindowsObject; ATitle : PCHAR);πBEGINπ     TWindow.Init(AParent,ATitle);π     WITH Attr DO BEGINπ          Style := Style OR ws_Child OR ws_Border;π     END;π     Partitions:=New(PPartitionCollection,Init(1,1));π     Setup;πEND;ππPROCEDURE TStatusLine.InsertItem(StrLength : WORD; Proc : TPaintProc);πBEGINπ     IF Partitions^.Count=0 THEN BEGINπ        Partitions^.Insert(New(PPartition,Init(@Self,Nil,0,StrLength,π        Proc)));π     ENDπ     ELSE BEGINπ       Partitions^.Insert(New(PPartition,Init(@Self,NIL,PPartition(π          Partitions^.At(Partitions^.Count-1))^.RightPosition,PPartition(π          Partitions^.At(Partitions^.Count-1))^.RightPosition+StrLength,π          Proc)));π     END;πEND;ππFUNCTION TStatusLine.GetPartition(Index : BYTE):PPartition;πBEGINπ     GetPartition:=NIL;π     IF Partitions^.Count<>0 THEN BEGINπ        GetPartition:=Partitions^.At(Index);π     END;πEND;ππPROCEDURE TStatusLine.Setup;πBEGINπEND;ππPROCEDURE TStatusLine.Paint(PaintHDC : HDC; VAR PaintInfo : TPaintStruct);πVARπ   R         : TRect;π   TheBrush  : HBrush;π   Pen,π   OldPen    : HPen;ππ   PROCEDURE CallPaint(P : PPartition);FAR;π   BEGINπ        P^.Paint(PaintHDC,PaintInfo);        π   END;ππBEGINπ     GetClientRect(Parent^.HWindow,R);π     MoveWindow(HWindow,0,R.Bottom-18,R.Right-R.Left,R.Bottom,TRUE);ππ     GetClientRect(HWindow,R);π     IF Partitions^.Count<>0 THEN BEGINπ        R.Left:=PPartition(π              Partitions^.At(Partitions^.Count-1))^.RightPosition;π     END;π     TheBrush:=CreateSolidBrush(GetSysColor(color_BtnFace));π     FillRect(PaintHdc,R,TheBrush);π     DeleteObject(TheBrush);ππ     Pen:=CreatePen(ps_Solid,1,RGB(255,255,255));π     OldPen:=SelectObject(PaintHDC,Pen);π     MoveTo(PaintHDC,R.Left,R.Top);π     LineTo(PaintHDC,R.Right,R.Top);π     MoveTo(PaintHdc,R.Left,R.Top);π     LineTo(PaintHdc,R.Left,R.Bottom);π     MoveTo(PaintHdc,R.Left+2,R.Top+15);π     LineTo(PaintHdc,R.Right-3,R.Top+15);π     LineTo(PaintHdc,R.Right-3,R.Top+2);ππ     DeleteObject(SelectObject(PaintHdc,OldPen));π     Pen:=CreatePen(ps_Solid,1,GetSysColor(color_btnShadow));π     OldPen:=SelectObject(PaintHDC,Pen);π     MoveTo(PaintHdc,R.Left+2,R.Top+2);π     LineTo(PaintHdc,R.Right-3,R.Top+2);π     MoveTo(PaintHdc,R.Right-1,R.Top);π     LineTo(PaintHdc,R.Right-1,R.Bottom);π     MoveTo(PaintHdc,R.Left+2,R.Top+2);π     LineTo(PaintHdc,R.Left+2,R.Top+15);ππ     DeleteObject(SelectObject(PaintHdc,OldPen));ππ     Partitions^.ForEach(@CallPaint);πEND;πππDESTRUCTOR TStatusLine.Done;πBEGINπ     Dispose(Partitions,Done);π     TWindow.Done;πEND;ππEND.ππ{------------------------   DEMO -------------------------}ππ (*************************************************************************π *                                                                        *π * STATUSEX.PAS - example program using the STATUS unit.                  *π *                By Thomas S. Carlisle                                   *π *                                                                        *π *                                                                        *π * This program sets up an example application demonstrating the use of   *π * the STATUS unit. A main window is created that has a statusline with   *π * a single partition that will display the current time.                 *π *                                                                        *π * I picked a clock example because it demonstrates how the main window   *π * can communicate with the statusline to tell it a certain partition     *π * needs to be redrawn.                                                   *π *                                                                        *π *************************************************************************)ππPROGRAM StatusEx;πUSESπ    WObjects,WinTypes,WinProcs,Status,WinDOS,Strings;ππCONSTπ     wm_UpdateTime   = $0400;  { User defined message }π      πTYPEπ    TimeRec = RECORD           π            Hour,π            Min     : WORD;π    END;ππ    PMyStatusLine = ^TMyStatusLine;ππ    TMyStatusLine = OBJECT(TStatusLine)    π        PROCEDURE Setup;VIRTUAL;π        PROCEDURE UpdateTime(VAR Msg : TMessage);π             VIRTUAL wm_First + wm_UpdateTime;π    END;ππ    PMyWindow = ^TMyWindow;ππ    TMyWindow = OBJECT(TWindow)π         StatusLine    : PMyStatusLine;π         CONSTRUCTOR Init(AParent : PWindowsObject; ATitle : PCHAR);π         PROCEDURE SetupWindow;VIRTUAL;π         DESTRUCTOR Done;VIRTUAL;π         PROCEDURE Timer(VAR Msg : TMessage);VIRTUAL wm_Timer;π    END;ππ    TMyApp = OBJECT(TApplication)π           PROCEDURE InitMainWindow;VIRTUAL;π    END;πππ(********************************* Globals **************************)ππVARπ   OldTime      : TimeRec;    { OldTime will be used to keep track ofπ                                whether or not the time has changed andπ                                needs to be redrawn                       }ππPROCEDURE Clock(PaintHdc : HDC; VAR PaintInfo : TPaintStruct);FAR;ππ{ This procedure MUST be declared as FAR because it is passed as aπ  parameter to the statusline, so the statusline will know what procedureπ  to call when the statusline needs to be drawn. The statusline draws theπ  actual box, but this procedure must fill in the text.ππ  Note the parameter list. It is mandatory, but also convenient. You willπ  need to use the PaintHDC as the device context for your text output. Theπ  PaintInfo is there just in case you need it. All procedures designed to beπ  passed to the statusline to be used to fill in the statusline partitionsπ  MUST have these two parameters!ππ  This procedure simply fills the box with the current time.              }ππVARπ   TimeStr      : ARRAY[0..5] OF CHAR;π   Hour,π   Minute,π   Sec,π   HSec         : WORD;π   TempStr,π   Temp1        : ARRAY[0..2] OF CHAR;πBEGINπ     StrCopy(TimeStr,' ');π     GetTime(Hour,Minute,Sec,HSec);π     OldTime.Hour:=Hour;          { Fill in OldTime record for future use }π     OldTime.Min:=Minute;π     Str(Hour,TempStr);           { Build the string that holds the time }π     StrCat(TimeStr,TempStr);π     StrCopy(TempStr,':');π     StrCat(TimeStr,TempStr);π     Str(Minute,TempStr);π     IF StrLen(TempStr)=1 THEN BEGINπ         StrCopy(Temp1,'0');π         StrCat(Temp1,TempStr);π         StrCopy(TempStr,Temp1);π     END; π     StrCat(TimeStr,TempStr);π     TextOut(PaintHdc,3,1,TimeStr,StrLen(TimeStr));   { Output the time }πEND;ππ(************************ TMyStatusLine Methods ************************)ππPROCEDURE TMyStatusLine.UpdateTime(VAR Msg : TMessage);ππ{ This procedure is a response method for TMyStatusLine. It responds toπ  the wm_UpdateTime user defined message. The procedure first checksπ  the current time against the time in OldTime. If they are different,π  then the clock status window is invalidated, to force it to be redrawnπ  with the new time.ππ  The reason this program is setup to keep track of the OldTime, and haveπ  this procedure check it, is to avoid flicker that occurs if the timeπ  is updated when it isn't necessary.                                    }ππVARπ   Hour,Min,Sec,HSec : WORD;πBEGINπ     GetTime(Hour,Min,Sec,HSec);π     IF (OldTime.Hour<>Hour) OR (OldTime.Min<>Min) THENπ          InvalidateRect(GetPartition(0)^.HWindow,NIL,TRUE);πEND;ππPROCEDURE TMyStatusLine.Setup;ππ{ Overrides the inherited Setup method. This setup method inserts oneπ  statusline partition in the status line. }ππBEGINπ     InsertItem(75,Clock);  { This inserts a new item in the statsuline.π                              The first parameter is the length (in pixels)π                              of the desired statusline partition. Theπ                              second parameter is the procedure this newπ                              partition will call whenever it needs to beπ                              redrawn. As stated earlier, the statuslineπ                              takes care of drawing the statusline and it'sπ                              partitions, but the procedure passed here isπ                              responsible for filling the partition withπ                              text }ππ                            { If you need more than one partition,π                              simply add more InsertItem statements. Eachπ                              one can be passed a length and procedureπ                              parameter. Very powerful.                  }ππEND;ππ(************************* TMyWindow Methods ***************************)ππCONSTRUCTOR TMyWindow.Init(AParent : PWindowsObject; ATitle : PCHAR);ππ{ TMyWindow is a descendant of TWindow. The only difference is it has aπ  StatusLine.                                                              }ππBEGINπ     TWindow.Init(AParent,ATitle);π     Statusline:=New(PMyStatusLine,Init(@Self,Nil));πEND;ππPROCEDURE TMyWindow.SetupWindow;ππ{ SetupWindow is needed in this application to start the timer that willπ  be used to spark messages every second to make sure the statusline clockπ  is kept up to date.                                                      }ππBEGINπ     TWindow.SetupWindow;π     IF SetTimer(HWindow,1,1000,NIL) = 0 THENπ        MessageBox(HWindow,'ERROR','Timer not available',mb_OK);πEND;ππPROCEDURE TMyWindow.Timer(VAR Msg : TMessage);ππ{ Responds to wm_Timer messages. First checks to make sure the incommingπ  message is ours (ID=1). If it is, it sends a wm_UpdateTime messageπ  to the statusline. That is the message the statusline responds to byπ  updating the time, if it has changed.                                   }π   πBEGINπ     IF Msg.wParam=1 THEN BEGINπ        SendMessage(StatusLine^.HWindow,wm_UpdateTime,0,0);     π     END;     πEND;ππDESTRUCTOR TMyWindow.Done;π{ Cleans up by killing the timer we started, and disposing the statusline }πBEGINπ     KillTimer(HWindow,1);π     Dispose(StatusLine,Done);π     TWindow.Done;πEND;ππ(****************************** TMyApp Methods ************************)ππPROCEDURE TMyApp.InitMainWindow;π{ Gets our main window (TMyWindow) in action }πBEGINπ     MainWindow:=New(PMyWindow,Init(NIL,'Test'));πEND;ππVARπ   MyApp   : TMyApp;πBEGINπ     MyApp.Init('Test');π     MyApp.Run;π     MyApp.Done;πEND.                          19     02-15-9407:53ALL                      ROBERT WARREN            Window Memory Stream     IMPORT              33     Kx   {π    Useful for transferring  objects which have been registered to the clipboard or any global memory situation.π    Also could be used to make a copy of any streamable object. Merely stream the object to memory and thenπ    re-instantiate a new object through the use of a TStream.Get. Solves theπ    problem of passing objects to another program because it removes any method pointer info.ππ    NOTE: This works only for streams which are not larger than 64K. In orderπ                to make this work for larger streams you have to ensure that yourπ                writes and puts (and gets and reads...) don't straddle each 64K boundary.π                I haven't added the pointer math to this unit yet.π}ππ{ Author Robert Warren CIS ID 70303,537 }ππUnit MemStream;ππinterfaceππ    Uses WinTypes,WinProcs, WObjects;ππ    typeππ        PMemStream = ^TMemStream;π        TMemStream = object(TStream)ππ                Handle: Word;π                Address: Pointer;π                Size: Longint;       { allocated size }π                Position: Longint;   { current position in stream }π                AllocFlags: LongInt; { flags required when allocating / reallocating }π                FreeMemory: Boolean; { Flag indicating whether to free globalπ                                                             memory when disposing of object }ππ            constructor Init(AllocSize: Longint; Flags: LongInt; FreeMem: Boolean);π            constructor InitWithHandle(aHandle: THandle; Flags: LongInt; FreeMem: Boolean);π            destructor Done; virtual;π            function GetPos: Longint; virtual;π            procedure Grow(howMuch: LongInt); virtual;π            function GetSize: Longint; virtual;π            procedure Read(var Buf; Count: Word); virtual;π            procedure Write(var Buf; Count: Word); virtual;π            procedure Seek(Pos: Longint); virtual;π            procedure Truncate; virtual;π        end;ππimplementationππ{π creates a memory stream of given size using the flags. The FreeMem argumentπ is used to determine whether to delete the global block of memory when theπ object is disposed of. Sometime you don't want to delete the block if forπ example it has been placed in the clipboard or passed using DDE.π}πconstructor TMemStream.Init(AllocSize: Longint; Flags: LongInt;FreeMem: Boolean);πbeginπ TStream.Init;π Handle:=GlobalAlloc( Flags, AllocSize);π Address:=GlobalLock(Handle); { so much for real mode }π Size:=AllocSize;π Position:=0;π FreeMemory:= FreeMem;πend;ππ{π same as above but allows for the creation of a object given an alreadyπ allocated memory block. Perhaps some data FROM a clipboardπ}πconstructor TMemStream.InitWithHandle(aHandle: THandle; Flags: LongInt;FreeMem: Boolean);πbeginπ TStream.Init;π Size:=GlobalSize(Handle);π Address:=GlobalLock(Handle);π Position:=0;π FreeMemory:= FreeMem;πend;πππdestructor TMemStream.Done;πbeginπ TStream.Done;π GlobalUnlock(Handle);π If FreeMemory then GlobalFree(Handle);πend;ππfunction TMemStream.GetPos: LongInt;πbeginπ    GetPos:=Position;πend;ππfunction TMemStream.GetSize: LongInt;πbeginπ    GetSize:=Size;πend;πππprocedure TMemStream.Read(var Buf; Count: Word);πvarπ varAddress: PChar;π stAddress: PChar;π i: LongInt;πbeginπ varAddress:=@Buf;π stAddress:=PChar(MakeLong(Position+LoWord(LongInt(Address)),HiWord(LongInt(Address))));π for i:=0 to Count -1 doπ     varAddress[i]:=stAddress[i];π inc(Position,Count);πend;ππprocedure TMemStream.Grow(HowMuch: LongInt);πbeginπ GlobalUnlock(Handle);π Inc(Size,HowMuch);π GlobalRealloc(Handle, Size, AllocFlags);π GlobalLock(Handle);πend;ππprocedure TMemStream.Write(var Buf; Count: Word);πvarπ varAddress: PChar;π stAddress: PChar;π i: LongInt;π growSize: Integer;πbeginππ if Position + Count >= Size thenπ     beginπ        if count < 1023π             then growSize:=1024π             else growSize:=count + 1;ππ        Grow(growSize);π     end;ππ varAddress:=@Buf;π stAddress:=PChar(MakeLong(Position+LoWord(LongInt(Address)),HiWord(LongInt(Address))));π for i:=0 to Count -1 doπ     stAddress[i]:=varAddress[i];π inc(Position,Count);πend;ππprocedure TMemStream.Seek(Pos: Longint);πbeginπ Position:=Pos;πend;ππprocedure TMemStream.Truncate;πbeginπ    GlobalUnlock(Handle);π    GlobalReAlloc(Handle,Position,AllocFlags);π    Address:=GlobalLock(Handle);π    Size:=Position;πend;ππend.ππ                                                                                             20     02-15-9407:55ALL                      SWAG SUPPORT TEAM        Set WINDOWS Wallpaper    IMPORT              31     Kx   Program Paper;ππ{$R-,I-,S-,L-,D-,G+}ππUsesπ  WinTypes,WinProcs,WObjects,Strings;ππ{ Declare undocumented Windows API call }ππProcedure SetDeskWallpaper(Name : PChar);π  Far; External 'USER' Index 285;ππVarπ  hPal : HPalette;ππ{---------------------------------------------------}ππ{ --- App/Win Object declarations --- }ππTypeπ  TPaperApp = Object(TApplication)π                Procedure InitMainWindow; Virtual;π              End;ππ  PPaperWindow = ^PaperWindow;π  PaperWindow = Object(TWindow)π                  Procedure SetupWindow;π                    Virtual;ππ                  Procedure WMQueryNewPalette(Var Msg : TMessage);π                    Virtual wm_QueryNewPalette;ππ                  Procedure WMPaletteChanged(Var Msg : TMessage);π                    Virtual wm_PaletteChanged;π                End;ππ{---------------------------------------------------}ππ{ --- App Methods --- }ππProcedure TPaperApp.InitMainWindow;ππBeginπ  If hPrevInst = 0π    Then MainWindow := New(PPaperWindow,Init(nil,'Paper'))π    Else Halt(0);πEnd {InitMainWindow};ππ{ --- Window Methods --- }ππ{---------------------------------------------------}ππProcedure PaperWindow.SetupWindow;ππVarπ  PaperStr : Array [0..80] Of Char;π  FName : String[80];π  DC : HDC;π  LogPal : TLogPalette;π  hOldPal : HPalette;ππBeginπ  { Retreive filename - if none: we just fixup the palette }π  FName := ParamStr(1);ππ  If FName <> ''π    Then Beginπ           { Add .BMP to filename, if necess. }π           If Pos('.',FName) = 0π             Then FName := FName + '.bmp';ππ           { Put string in "C" style }π           StrPCopy(PaperStr,FName);ππ           { Make sure we keep WIN.INI apprised of our changes }π           WriteProfileString('Desktop','Wallpaper',PaperStr);ππ           { Set the wallpaper }π           SetDeskWallpaper(PaperStr);   { Undoc'd win call }π         End;ππ  { Invalidate the screen, even if we don't load a new wallpaper - ifπ    we don't do this, the "transparent" areas of icons will be fratzed up }π  InvalidateRect(0,Nil,False);ππ  { Create a small palette to fix the fact that loading the wallpaperπ    doesn't realize the palette }ππ  LogPal.palVersion := $0300;π  LogPal.palNumEntries := 1;π  LogPal.palPalEntry[0].peRed := 0;π  LogPal.palPalEntry[0].peGreen := 0;π  LogPal.palPalEntry[0].peBlue := 0;π  LogPal.palPalEntry[0].peFlags := 0;ππ  { Get a DC and realize our palette }π  DC := GetDC(HWindow);ππ  hPal := CreatePalette(LogPal);π  hOldPal := SelectPalette(DC,hPal,False);ππ  RealizePalette(DC);ππ  { Close up our palette stuff }π  SelectPalette(DC,hOldPal,False);ππ  DeleteObject(hPal);π  ReleaseDC(HWindow,DC);ππ  { Close ourselves automatically }π  PostMessage(HWindow,wm_Close,0,0);ππEnd {SetupWindow};ππ{---------------------------------------------------}ππProcedure PaperWindow.WMQueryNewPalette(Var Msg : TMessage);ππVarπ  ahDC : HDC;ππBeginπ  ahDC := GetDC(HWindow);π  SelectPalette(ahDC,hPal,False);ππ  If (RealizePalette(ahDC) > 0)π    Then Beginπ           ReleaseDC(HWindow,ahDC);π           InvalidateRect(HWindow,Nil,False)π         Endπ    Else ReleaseDC(HWindow,ahDC);πEnd {WMQueryNewPalette};ππ{---------------------------------------------------}ππProcedure PaperWindow.WMPaletteChanged(Var Msg : TMessage);ππVarπ  ahDC : HDC;ππBeginπ  If Msg.wParam <> HWindowπ    Then Beginπ           ahDC := GetDC(HWindow);π           SelectPalette(ahDC,hPal,False);ππ           If (RealizePalette(ahDC) > 0)π             Then InvalidateRect(HWindow,nil,False);ππ           ReleaseDC(HWindow,ahDC);π         End;πEnd {WMPaletteChanged};ππ{---------------------------------------------------}ππ{ --- Main --- }ππVarπ  PaperApp : TPaperApp;ππBeginπ  CmdShow := sw_Minimize;ππ  PaperApp.Init('Paper');π  PaperApp.Run;π  PaperApp.Done;πEnd.π                                                                         21     05-25-9408:00ALL                      MICHAEL HOENIE           Loading .BMP             SWAG9405            27     Kx   {************************************************}π{                                                }π{   Turbo Pascal for Windows                     }π{   Demo unit                                    }π{   Copyright (c) 1991 by Borland International  }π{                                                }π{************************************************}ππ{$R-}ππunit LoadBMPs;ππinterfaceππuses WinProcs, WinTypes, Strings, WinDos;π  { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I do not have these units!!! }ππfunction LoadBMP(Name: PChar; Window: hWnd; var DibPal: Word;π var Width, Height: LongInt): hBitMap;ππimplementationππfunction CreateBIPalette(BI: PBitMapInfoHeader): HPalette;πtypeπ ARGBQuad = Array[1..5000] of TRGBQuad;πvarπ RGB: ^ARGBQuad;π NumColors: Word;π Pal: PLogPalette;π hPal: hPalette;π I: Integer;πbeginπ CreateBiPalette := 0;π RGB := Ptr(Seg(BI^), Ofs(BI^)+BI^.biSize);π if BI^.biBitCount<24 thenπ beginπ   NumColors:= 1 shl BI^.biBitCount;π   if NumColors<>0 thenπ   beginπ     GetMem(Pal, SizeOf(PLogPalette)+NumColors*SizeOf(TPaletteEntry));π     Pal^.palNumEntries := NumColors;π     Pal^.palVersion := $300;π     for I := 0 to NumColors-1 doπ     beginπ       Pal^.palPalEntry[I].peRed := RGB^[I].rgbRed;π       Pal^.palPalEntry[I].peGreen := RGB^[I].rgbGreen;π       Pal^.palPalEntry[I].peBlue := RGB^[I].rgbBlue;π       Pal^.palPalEntry[I].peFlags := 0;π     end;π     hPal := CreatePalette(Pal^);π     FreeMem(Pal, SizeOf(PLogPalette) + NumColors * SizeOf(TPaletteEntry));π     CreateBiPalette := hPal;π   end;π end;πend;ππfunction LoadBMP(Name: PChar; Window: hWnd; var DibPal: Word;π var Width, Height: LongInt): hBitMap;πvarπ BitMapFileHeader: TBitMapFileHeader;π DibSize, ReadSize, ColorTableSize, TempReadSize: LongInt;π DIB: PBitMapInfoHeader;π TempDib: Pointer;π Bits: Pointer;π F: File;π BitMap: hBitMap;π Handle: Word;π DC: hDC;π OldCursor: HCursor;πbeginπ Assign(F, Name);π {$I-}Reset(F, 1);{$I+}π if IOResult<>0 thenπ beginπ   LoadBMP := 0;π   Exit;π end;π OldCursor := SetCursor(LoadCursor(0, IDC_Wait));π BlockRead(F, BitMapFileHeader, SizeOf(BitMapFileHeader));π DibSize := BitMapFileHeader.bfSize - BitMapFileHeader.bfOffBits;π ReadSize := LongInt(BitMapFileHeader.bfSize) - SizeOf(BitMapFileHeader);π Handle := GlobalAlloc(GMem_Moveable, ReadSize);π DIB := GlobalLock(Handle);π TempReadSize := ReadSize;π TempDib := Dib;π while TempReadSize > 0 doπ beginπ   if TempReadSize > $8000 thenπ   beginπ     BlockRead(F, TempDIB^, $8000);π     if Ofs(TempDib^) = $8000 thenπ        TempDib := Ptr(Seg(TempDib^) + 8, 0)π     elseπ        TempDib := Ptr(Seg(TempDib^), $8000);π   endπ   elseπ     BlockRead(F, TempDIB^, TempReadSize);π   Dec(TempReadSize, $8000);π end;π if DIB^.biBitCount = 24 thenπ   ColorTableSize := 0π elseπ   ColorTableSize := LongInt(1) shl DIB^.biBitCount * SizeOf(TRGBQuad);π Bits := Ptr(Seg(DIB^), Ofs(DIB^) + DIB^.biSize + ColorTableSize);π Close(F);π DC := GetDC(Window);π DibPal := CreateBIPalette(DIB);π if DibPal = 0 thenπ beginπ   SelectPalette(DC, DibPal, false);π   RealizePalette(DC);π end;π BitMap := CreateDIBitMap(DC, DIB^, cbm_Init, Bits, PBitMapInfo(Dib)^,π   dib_RGB_Colors);π Height := DIB^.biHeight;π Width := DIB^.biWidth;π ReleaseDC(Window, DC);π GlobalUnLock(Handle);π GlobalFree(Handle);π LoadBMP := BitMap;π SetCursor(OldCursor);πend;ππend.π     22     05-25-9408:10ALL                      DOUG WEGSCHEID           Extended GetDriveType    SWAG9405            61     Kx   (*π        Extended GetDriveType for Windows 3.0/3.1.ππ        Code ported the C in Microsoft PSS document Q105922.ππ        Doug Wegscheid 3/22/94.π*)ππ{$DEFINE TEST}        { undefine to make a unit }ππ{$IFDEF TEST}πprogram drivetyp;πuses wincrt, windos, winprocs, wintypes;π{$ELSE TEST}πunit drivetyp;ππinterfaceπ{$ENDIF}ππ{ Return values of GetDriveTypeEx(). }πconstπ EX_DRIVE_INVALID    = 0;π EX_DRIVE_REMOVABLE  = 1;π EX_DRIVE_FIXED      = 2;π EX_DRIVE_REMOTE     = 3;π EX_DRIVE_CDROM      = 4;π EX_DRIVE_FLOPPY     = 5;π EX_DRIVE_RAMDISK    = 6;ππ{$IFNDEF TEST}πfunction GetDriveTypeEx (nDrive : integer) : integer;ππimplementationπuses windos, winprocs, wintypes;π{$ENDIF}ππ{π See the "MS-DOS Programmer's Reference" for further informationπ about this structure. It is the structure returned with an IOCTLπ $0D function, $60 subfunction (get device parameters).π}πtypeπ DeviceParams = recordπ  bSpecFunc        : byte;                { Special functions }π  bDevType        : byte;                { Device type }π  wDevAttr        : word;         { Device attributes }π  wCylinders        : word;                { Number of cylinders }π  bMediaType        : byte;                { Media type }π  { Beginning of BIOS parameter block (BPB) }π  wBytesPerSec        : word;                { Bytes per sector }π  bSecPerClust        : byte;                { Sectors per cluster }π  wResSectors        : word;              { Number of reserved sectors }π  bFATs                : byte;         { Number of FATs }π  wRootDirEnts        : word;             { Number of root-directory entries }π  wSectors        : word;         { Total number of sectors }π  bMedia        : byte;         { Media descriptor }π  wFATsecs        : word;         { Number of sectors per FAT }π  wSecPerTrack        : word;             { Number of sectors per track }π  wHeads        : word;         { Number of heads }π  dwHiddenSecs        : longint;             { Number of hidden sectors }π  dwHugeSectors        : longint;            { Number of sectors if wSectors == 0 }π  { End of BIOS parameter block (BPB) }π end;ππfunction GetDeviceParameters (nDrive : integer; var dp : DeviceParams) : boolean;π(*π //-----------------------------------------------------------------π // GetDeviceParameters()π //π // Fills a DeviceParams struct with info about the given drive.π // Calls DOS IOCTL Get Device Parameters (440Dh, 60h) function.π //π // Parametersπ //   nDrive   Drive number  0 = A, 1 = B, 2 = C, and so on.π //   dp       A structure that will contain the drive's parameters.π //π // Returns TRUE if it succeeded, FALSE if it failed.π //-----------------------------------------------------------------π*)πvarπ r                : TRegisters;πbeginπ fillchar(r,sizeof(r),#0);        { clean up registers to avoid GPF }π r.ax := $440d;                        { IOCTL }π r.ch := $08;                        { block device }π r.cl := $60;                        { get device parameters }π r.bx := nDrive + 1;                { 1 = A:, 2 = B:, etc... }π r.ds := seg(dp); r.dx := ofs(dp);        { where... }π msdos(r);π GetDeviceParameters := (r.flags and fCarry) = 0πend;ππfunction IsCDRomDrive (nDrive : integer) : boolean;π(*π //-----------------------------------------------------------------π // IsCDRomDrive()π //π // Determines if a drive is a CD-ROM. Calls MSCDEX and checksπ // that MSCDEX is loaded, and that MSCDEX reports the drive is aπ // CD-ROM.π //π // Parametersπ //    nDrive    Drive number  0 = A, 1 = B, 2 = C, and so forth.π //π // Returns TRUE if nDrive is a CD-ROM drive, FALSE if it isn't.π //-----------------------------------------------------------------π*)πvarπ r        : TRegisters;πbeginπ fillchar(r,sizeof(r),#0);        { clean up registers to avoid GPF andπ                                  to ensure that BX = $ADAD would notπ                                  be by accident }π r.ax := $150b;                        { MSCDEX installation check }π {π   This function returns whether or not a drive letter is a CD-ROMπ   drive supported by MSCDEX. If the extensions are installed, BXπ   will be set to ADADh. If the drive letter is supported byπ   MSCDEX, then AX is set to a non-zero value. AX is set to zeroπ   if the drive is not supported. One must be sure to check theπ   signature word to know that MSCDEX is installed and that AXπ   has not been modified by another INT 2Fh handler.π }π r.cx := nDrive;                { 0 = A:, 1 = B:, etc... }π intr ($2f, r);                        { do it }π IsCDRomDrive := (r.bx = $adad) and (r.ax <> 0)πend;ππ(*π //-----------------------------------------------------------------π // GetDriveTypeEx()π //π // Determines the type of a drive. Calls Windows's GetDriveTypeπ // to determine if a drive is valid, fixed, remote, or removeable,π // then breaks down these categories further to specific deviceπ // types.π //π // Parametersπ //    nDrive    Drive number  0 = A, 1 = B, 2 = C, etc.π //π // Returns one of:π //    EX_DRIVE_INVALID         -- Drive not detectedπ //    EX_DRIVE_REMOVABLE       -- Unknown removable-media type driveπ //    EX_DRIVE_FIXED           -- Hard disk driveπ //    EX_DRIVE_REMOTE          -- Remote drive on a networkπ //    EX_DRIVE_CDROM           -- CD-ROM driveπ //    EX_DRIVE_FLOPPY          -- Floppy disk driveπ //    EX_DRIVE_RAMDISK         -- RAM diskπ //-----------------------------------------------------------------π*)πfunction GetDriveTypeEx (nDrive : Integer) : integer;πvarπ dp        : DeviceParams;π utype        : integer;πbeginπ fillchar (dp, sizeof(dp), #0);        { clear the DPB }π uType := GetDriveType(nDrive);        { make a rough guess }π case uType ofππ  DRIVE_REMOTE:π   { GetDriveType() reports CD-ROMs as Remote drives. Needπ     to see if the drive is a CD-ROM or a network drive. }π   if IsCDRomDrive (nDrive)π    then GetDriveTypeEx := EX_DRIVE_CDROMπ    else GetDriveTypeEx := EX_DRIVE_REMOTE;ππ  DRIVE_REMOVABLE:π   {π     Check for a floppy disk drive. If it isn't, then weπ     don't know what kind of removable media it is.π     For example, could be a Bernoulli box or something new...ππ     DOS 6.0 Reference says devicetype 0=320/360kb floppy,π     1=1.2Mb, 2=720kb, 3=8" single density, 4=8" double density,π     7=1.44Mb, 8=optical, 9=2.88Mb. Code in Q105922 didn't pickπ     up bDevType=9.π   }π   if GetDeviceParameters (nDrive, dp) and (dp.bDevType in [0..4,7..9])π    then GetDriveTypeEx := EX_DRIVE_FLOPPYπ    else GetDriveTypeEx := EX_DRIVE_REMOVABLE;ππ  DRIVE_FIXED:π   {π     GetDeviceParameters returns a device type of 0x05 forπ     hard disks. Because hard disks and RAM disks are the twoπ     types of fixed-media drives, we assume that any fixed-π     media drive that isn't a hard disk is a RAM disk.π   }π   if GetDeviceParameters (nDrive, dp) and (dp.bDevType = 5)π    then GetDriveTypeEx := EX_DRIVE_FIXEDπ    else GetDriveTypeEx := EX_DRIVE_RAMDISK;ππ  elseπ   GetDriveTypeEx := EX_DRIVE_INVALIDπ endπend;ππ{$IFDEF TEST}πvarπ i, d        : integer;πbeginπ for i := 0 to 25π  do beginπ   d := GetDriveTypeEx(i);π   if d <> EX_DRIVE_INVALIDπ    then beginπ     write (chr(i + ord('A')), ': ');π     case GetDriveTypeEx(i) ofπ      EX_DRIVE_REMOVABLE:        Writeln ('Removable');π      EX_DRIVE_FIXED:                Writeln ('Harddisk');π      EX_DRIVE_REMOTE:                Writeln ('Network');π      EX_DRIVE_CDROM:                Writeln ('CDROM');π      EX_DRIVE_FLOPPY:                Writeln ('Floppy');π      EX_DRIVE_RAMDISK:                Writeln ('RAMdisk')π     endπ    endπ  endπ{$ENDIF}πend.                                                                                                           23     05-26-9406:10ALL                      ANDREW J. COOK           Printer Controls         IMPORT              61     Kx   {************************************************}π{                                                }π{   AJC Printer Unit for Windows                 }π{                                                }π{   Printer control constants/functions          }π{                                                }π{   Author:  Andrew J. Cook                      }π{            Omaha, NE                           }π{            CompuServe ID:  71331,501           }π{                                                }π{   Written: January 1994                        }π{                                                }π{   Copyright:  None!  I hereby commit this unit }π{                      to the public domain.     }π{                                                }π{************************************************}ππ{************************************************}π{                                                }π{  New SetPageSize function added and changed    }π{  margin code in SetPrintParams function.       }π{                                                }π{  Modified by:                                  }π{               Paul Mayer                       }π{               ZPAY Payroll Systems, Inc.       }π{               St. Petersburg,  FL              }π{               CompuServe ID: 76711,1141        }π{                                                }π{  Thanks to Kurt Barthelmess Borland Team B for }π{  pointing out what I was doing wrong so I      }π{  could get this function to work after a week  }π{  of trial and error and a lot of test paper!   }π{                                                }π{                                 April 1994     }π{                                                }π{************************************************}ππunit AJCPrntW;ππ{$F+,O+,S-}ππinterfaceππuses WinTypes, WinProcs, OPrinter;ππtypeπ  PAJCPrinter = ^TAJCPrinter;π  TAJCPrinter = object(TPrinter)π    function SetPageOrientation(Orientation:  Integer): Integer; virtual;π    function SetPageSize(PageID, NewLength, NewWidth : Integer) : Integer; virtual;π  end;ππconstπ  pm_Size = 1;π  pm_Print = 2;ππtypeπ  PAJCPrintOut = ^TAJCPrintOut;π  TAJCPrintOut = object(TPrintOut)π    VUnitsPerInch:  Integer;π    HUnitsPerInch:  Integer;π    LMarginUnits:  Integer;π    TMarginUnits:  Integer;π    RMarginUnits:  Integer;π    BMarginUnits:  Integer;π    OriginalAlignmentOptions:  Word;π    constructor Init(ATitle:  PChar);π    destructor Done; virtual;π    procedure SetPrintParams(ADC: HDC; ASize: TPoint); virtual;π    function VLogPos(Pos:  Integer): Integer; virtual;π    function HLogPos(Pos:  Integer): Integer; virtual;π    function VInches(Inches: Real): Integer; virtual;π    function HInches(Inches: Real): Integer; virtual;π    function Points(APoints:  Integer): Integer; virtual;π    function PrintHeader(Mode, Page:  Word): Integer; virtual;π    function PrintFooter(Mode, Page:  Word): Integer; virtual;π    procedure JustifyLeft;π    procedure JustifyCenter;π    procedure JustifyRight;π  end;ππvarπ  DevModeOut, DevModeIn : PDevMode;ππimplementationππfunction TAJCPrinter.SetPageOrientation(Orientation: Integer): Integer;πvarπ  DevMode:  PDevMode;π  Result:  Integer;πbeginπ  SetPageOrientation := -1;π  if (Orientation <> dmOrient_Portrait) andπ     (Orientation <> dmOrient_Landscape) thenπ       exit;π  if @ExtDeviceMode = nil then exit;π  if DevSettings^.dmFields or dm_Orientation = 0 then exit;ππ  if DevSettings^.dmOrientation = Orientation thenπ    beginπ      SetPageOrientation := 1;π      exit;π    end;ππ  GetMem(DevMode, DevSettingSize);π  Move(DevSettings^, DevMode^, DevSettingSize);π  DevMode^.dmOrientation := Orientation;π  Result := ExtDeviceMode(0, DeviceModule, DevSettings^, Device, Port,π                          DevMode^, nil, dm_In_Buffer or dm_Out_Buffer);π  FreeMem(DevMode, DevSettingSize);π  if Result = IDOK thenπ    SetPageOrientation := 0;πend;ππfunction TAJCPrinter.SetPageSize(PageID, NewLength, NewWidth : Integer): Integer;πvarπ  DevModeIn:  PDevMode;π  Result:  Integer;π  Size : Integer;πbeginπ  SetPageSize := -1;π  if @ExtDeviceMode = nil then exit;π  GetMem(DevModeIn, DevSettingSize);π  Result := ExtDeviceMode(0, DeviceModule, DevSettings^, Device, Port,π                          DevModeIn^, nil, dm_Out_Buffer);π  DevModeIn^.dmDeviceName := DevSettings^.dmDeviceName;π  DevModeIn^.dmSpecVersion := DevSettings^.dmSpecVersion;π  DevModeIn^.dmDriverVersion := 0;π  DevModeIn^.dmFields := dm_PaperSize or dm_Paperlength or dm_PaperWidth;π  DevModeIn^.dmPaperSize := PageId {eg dmPaper_User, dmPaper_Letter};π  DevModeIn^.dmPaperLength := NewLength; {in 1/10 of millimeters}π  DevModeIn^.dmPaperWidth := NewWidth {in 1/10 of millimeters};π  Result := ExtDeviceMode(0, DeviceModule, DevSettings^, Device, Port,π                          DevModeIn^, nil, dm_In_Buffer or dm_Out_Buffer);π  FreeMem(DevModeIn, DevModeIn^.dmSize + DevModeIn^.dmDriverExtra);π  if Result = IDOK thenπ    SetPageSize := 0;πend;ππconstructor TAJCPrintOut.Init(ATitle:  PChar);πbeginπ  inherited Init(ATitle);π  OriginalAlignmentOptions := 0;πend;ππdestructor TAJCPrintOut.Done;πbeginπ  if OriginalAlignmentOptions <> 0 thenπ    SetTextAlign(DC, OriginalAlignmentOptions);ππ  inherited Done;πend;ππprocedure TAJCPrintOut.SetPrintParams(ADC: HDC; ASize: TPoint);πvarπ  lpOffset, lpDimensions : TPoint;πbeginπ  inherited SetPrintParams(ADC, ASize);ππ  OriginalAlignmentOptions := GetTextAlign(DC);ππ  VUnitsPerInch := GetDeviceCaps(DC, LogPixelsY);π  HUnitsPerInch := GetDeviceCaps(DC, LogPixelsX);ππ  Escape(DC, GetPhysPageSize, 0, nil, @lpDimensions);π  Escape(DC, GetPrintingOffset, 0, nil, @lpOffset);ππ  TMarginUnits := lpOffset.Y;π  LMarginUnits := lpOffset.X;π  BMarginUnits := (lpDimensions.Y - (Size.Y+lpOffset.Y));π  RMarginUnits := (lpDimensions.X - (Size.X+lpOffset.X));πend;ππfunction TAJCPrintOut.VLogPos(Pos: Integer): Integer;πbeginπ  if Pos < 0 thenπ    VLogPos := Size.Y + Pos + TMarginUnitsπ  elseπ    VLogPos := Pos - TMarginUnits;πend;πππfunction TAJCPrintOut.HLogPos(Pos: Integer): Integer;πbeginπ  if Pos < 0 thenπ    HLogPos := Size.X + Pos + LMarginUnitsπ  elseπ    HLogPos := Pos - LMarginUnits;πend;ππfunction TAJCPrintOut.VInches(Inches: Real): Integer;πbeginπ  VInches := round(Inches * VUnitsPerInch);πend;ππfunction TAJCPrintOut.HInches(Inches: Real): Integer;πbeginπ  HInches := round(Inches * HUnitsPerInch);πend;ππfunction TAJCPrintOut.Points(APoints:  Integer): Integer;πbeginπ  Points := APoints * (VUnitsPerInch) div 72;πend;ππfunction TAJCPrintOut.PrintHeader(Mode, Page:  Word):  Integer;πbeginπ  PrintHeader := 0;πend;ππfunction TAJCPrintOut.PrintFooter(Mode, Page:  Word):  Integer;πbeginπ  PrintFooter := 0;πend;ππprocedure TAJCPrintOut.JustifyLeft;πvarπ  AlignmentOptions:  Word;πbeginπ  AlignmentOptions := GetTextAlign(DC);π  AlignmentOptions := AlignmentOptions and not (ta_left or ta_center or ta_right);π  AlignmentOptions := AlignmentOptions or ta_left;π  SetTextAlign(DC, AlignmentOptions);πend;ππprocedure TAJCPrintOut.JustifyCenter;πvarπ  AlignmentOptions:  Word;πbeginπ  AlignmentOptions := GetTextAlign(DC);π  AlignmentOptions := AlignmentOptions and not (ta_left or ta_center or ta_right);π  AlignmentOptions := AlignmentOptions or ta_center;π  SetTextAlign(DC, AlignmentOptions);πend;ππprocedure TAJCPrintOut.JustifyRight;πvarπ  AlignmentOptions:  Word;πbeginπ  AlignmentOptions := GetTextAlign(DC);π  AlignmentOptions := AlignmentOptions and not (ta_left or ta_center or ta_right);π  AlignmentOptions := AlignmentOptions or ta_right;π  SetTextAlign(DC, AlignmentOptions);πend;πππbeginπend.π                                                                       24     05-26-9407:31ALL                      MORTEN WELINDER          32bit Protected Mode     IMPORT              73     Kx   {π>What you *can* do is these things.ππ>1. You can modify the limit of a selector from $0000FFFF toπ>   $xxxxFFFF so assembler code can use 32-bit addressing.π>   Note that you may not change the lower 16-bit of the limitπ>   field, or else the DPMI server crashes.ππ>2. You can compile a 32-bit assembler procedure into yourπ>   program.  It just needs a tiny (16 byte) wrapper and mustπ>   reside in the low 64K of a segment (or else interruptsπ>   cannot return correctly).  However, the BP linker doesπ>   not support 32-bit fixups so there are limits as to whatπ>   you can put into the assembler code.ππ>3. If you are willing to give up assembler access to BPπ>   variables, then you can make a binary image and linkπ>   that into your program.  Then you can do whatever pleasesπ>   you in the assembler procedure.ππ>If there is interrest, I could post an example routine showingπ>this.ππThree files are needed: a batch file for assembly, an assemblerπfile with 32-bit code, and a pascal test program.  The testπprogram is not supposed to do anything useful.ππThe code is unsupported.  You must know what you're doing.πYou'll need the `exe2bin' or `exetobin' utility; you'll needπBP7 (with Turbo Assembler, and you cannot use TP7).  You mustπbe using Borland's DPMI or some DPMI that supports 32-bitπprograms.  Don't even think about running this on a 286.  Whenπthings go wrong it's not my fault.  Don't tell me you know aπbetter way to get the segment limit, because so do I.ππMorten Welinderπterra@diku.dkππ{ THE BATCH FILE }π{ CUT HERE }π{***************************************************************************}ππ@Echo OffπTasm /M2 /T /L Test32πIf Not Exist Test32.Obj Goto EndπTlink /x test32 >NulπExe2bin Test32.Exe Test32.BinπRem Del Test32.ExeπDel Test32.Objπ:Endππ{ THE ASSEMBLER PROGRAM }π{ CUT HERE }π{***************************************************************************}ππ; ---------------------------------------------------------------------------π; Example 32 bit program for use with Borland Pascal 7.0π; ---------------------------------------------------------------------------πIdeal                                  ; (Keep Tasm happy)πP386πModel Use32 Huge,PascalπSegment Code Use32πAssume  Cs:Codeπ; ---------------------------------------------------------------------------πEntry0:  Movzx Eax,[Word Esp]          ; Change the stack frame to 32 bitsπ         Shr   [Dword Esp],16          ; so [Esp+xxx] works as expected.π         Push  Eaxπ         Jmp   P0πAlign 10hπEntry1:  Movzx Eax,[Word Esp]          ; Aligned 10h for speed.π         Shr   [Dword Esp],16π         Push  Eaxπ         Jmp   P1πAlign 10hπEntry2:  Movzx Eax,[Word Esp]          ; Aligned 10h for speed.π         Shr   [Dword Esp],16π         Push  Eaxπ         Jmp   P2π; etc.π; ---------------------------------------------------------------------------πAlign 10hπProc P0 Far L1:Dword,L2:Dwordπ         Mov   Eax,[L1]                ; Add the parametersπ         Add   Eax,[L2]ππ         Shld  Edx,Eax,16              ; Output is left in Dx:Axπ         RetπEndpπ; ---------------------------------------------------------------------------πAlign 10hπProc P1 Farπ         Push  Ds                      ; Call MsDos from a 32 bit segmentπ         Mov   Ax,Cs                   ; Never ever perform a softwareπ         Mov   Ds,Ax                   ; interrupt if Ip>=64K!π         Mov   Ah,9π         Mov   Edx,Offset Messageπ         Int   21hπ         Pop   Dsπ         RetππMessage  Db    'Hello, 32 bit world!',13,10,'$'πEndpπ; ---------------------------------------------------------------------------πAlign 10hπProc P2 Far P:Dwordπ         Push  Dsπ         Xor   Esi,Esiπ         Lds   Si,[Small P]π         Mov   Ecx,20000h/4π  @@1:   Mov   [Esi],Esiπ         Add   Esi,4π         Loop  @@1π         Pop   Dsπ         RetπEndpπ; ---------------------------------------------------------------------------πEndsπEndππ{ THE TEST PROGRAM }π{ CUT HERE }π{***************************************************************************}ππProgram   Test;π{ ------------------------------------------------------------------------- }πUses      Winapi, Dos;π{ ------------------------------------------------------------------------- }πConst     Dpmi_32BitSegment           = $4000;ππType      Dpmi_Descriptor             = Recordπ            Limit0015                 : Word;π            Base0015                  : Word;π            Base1623                  : Byte;π            Rights                    : Byte;   { 7=Prsnt, 6-5=Dpl, 4=App,  }π                                                { 3-0=Type                  }π            Rights386                 : Byte;   { 7=Gran, 6=Size32, 5=0,    }π                                                { 4=Avail, 3-0=Limit1619    }π            Base2431                  : Byte;π            End;ππVar       Sel      : Word;π          Oldright : Word;π          ProcPtr  : Pointer;π          P1       : Function(L1,L2: LongInt): LongInt;π          P2       : Procedure;π          P3       : Procedure(P: Pointer);π          Fil      : File;π          Data     : Pointer;π          Dsel     : Word;π{ ------------------------------------------------------------------------- }πProcedure Dpmi_SetSelectorLimit(Sel: Word; Limit: LongInt); Assembler;πAsm    Mov   Ax,0008Hπ       Mov   Bx,[Sel]π       Mov   Dx,[Word Ptr Limit]π       Mov   Cx,[Word Ptr Limit+2]π       Int   31HπEnd;π{ ------------------------------------------------------------------------- }πProcedure Dpmi_GetDescriptor(Sel: Word; Var Buffer: Dpmi_Descriptor); Assembler;πAsm    Mov   Ax,000Bhπ       Mov   Bx,[Sel]π       Les   Di,[Buffer]π       Int   31HπEnd;π{ ------------------------------------------------------------------------- }πProcedure Dpmi_SetDescriptor(Sel: Word; Var Buffer: Dpmi_Descriptor); Assembler;πAsm    Mov   Ax,000Chπ       Mov   Bx,[Sel]π       Les   Di,[Buffer]π       Int   31HπEnd;π{ ------------------------------------------------------------------------- }πFunction  Dpmi_GetAccessRights(Sel: Word): Word; Assembler;πVar       Buffer : Dpmi_Descriptor;πAsm    Mov   Bx,[Sel]π       Push  Bxπ       Push  Ssπ       Lea   Di,[Buffer]π       Push  Diπ       Call  Dpmi_GetDescriptorπ       Mov   Ax,[Word Ptr Buffer+5]πEnd;π{ ------------------------------------------------------------------------- }πProcedure Dpmi_SetAccessRights(Sel: Word; Rights: Word); Assembler;πVar       Buffer : Dpmi_Descriptor;πAsm    Mov   Bx,[Sel]π       Lea   Di,[Buffer]π       Push  Bxπ       Push  Ssπ       Push  Diπ       Push  Bxπ       Push  Ssπ       Push  Diπ       Call  Dpmi_GetDescriptorπ       Mov   Ax,[Word Ptr Buffer+5]π       And   Ax,8F00hπ       Mov   Bx,[Rights]π       And   Bx,50Ffhπ       Or    Ax,Bxπ       Mov   [Word Ptr Buffer+5],Axπ       Call  Dpmi_SetDescriptorπEnd;π{ ------------------------------------------------------------------------- }πFunction  Dpmi_GetSelectorLimit(Sel: Word): LongInt; Assembler;πVar       Buffer : Dpmi_Descriptor;πAsm    Mov   Bx,[Sel]π       Push  Bxπ       Push  Ssπ       Lea   Di,[Buffer]π       Push  Diπ       Call  Dpmi_GetDescriptorπ       Mov   Dx,[Word Ptr Buffer+6]π       Mov   Ax,[Word Ptr Buffer]π       Test  Dl,80Hπ       Je    @@3π       Mov   Bx,Axπ       Mov   Cl,4π       Shr   Bx,Clπ       Mov   Cl,12π       Shl   Dx,Clπ       Shl   Ax,Clπ       Or    Dx,Bxπ       Or    Ax,0Fffhπ       Jmp   @@2π  @@3: And   Dx,0Fhπ       Jmp   @@2π  @@1: Mov   Ax,0π       Mov   Dx,0π  @@2:πEnd;π{ ------------------------------------------------------------------------- }πFunction Int2HexN(L: LongInt; N:Integer): String;πConst    Digits : Array[0..15] Of Char = '0123456789ABCDEF';πVar      S : String;πBeginπ  S:='';π  While N>0 Do Beginπ    S:=Digits[L And $F]+S;π    Dec(N);π    L:=L Shr 4;π  End;π  Int2HexN:=S;πEnd;π{ -------------------------------------------------------------------------- }πππBeginπ  Data:=GlobalallocPtr(Gmem_Zeroinit,$20000);π  Dsel:=Seg(Data^);π  Dpmi_SetSelectorLimit(Dsel,$1FFFF);ππ  GetMem(ProcPtr,$4000);π  Assign(Fil,'Test32.Bin');π  Reset(Fil,1);π  BlockRead(Fil,ProcPtr^,FileSize(Fil));π  Close(Fil);π  LongInt(@P1):=(LongInt(ProcPtr)+0*16);π  LongInt(@P2):=(LongInt(ProcPtr)+1*16);π  LongInt(@P3):=(LongInt(ProcPtr)+2*16);ππ  Sel:=Seg(ProcPtr^);π  Oldright:=Dpmi_GetAccessRights(Sel);π  Dpmi_SetAccessRights(Sel,(Oldright Or Dpmi_32BitSegment) And $FFF1+$A);ππ  Writeln('Proc:   ',Int2HexN(Sel,4),':',Int2HexN(Ofs(ProcPtr^),8));π  Writeln('Base:   ',Int2HexN(Getselectorbase(Sel),8));π  Writeln('Limit:  ',Int2HexN(Dpmi_GetSelectorLimit(Sel),8));π  Writeln('Rights: ',Int2HexN(Dpmi_GetAccessRights(Sel),4));π  Writeln;π  Writeln('Data:   ',Int2HexN(Seg(Data^),4),':',Int2HexN(Ofs(Data^),8));π  Writeln('Base:   ',Int2HexN(Getselectorbase(Dsel),8));π  Writeln('Limit:  ',Int2HexN(Dpmi_GetSelectorLimit(Dsel),8));π  Writeln('Rights: ',Int2HexN(Dpmi_GetAccessRights(Dsel),4));π  Writeln;π  Writeln('Ss:Sp:  ',Int2HexN(SSeg,4),':',Int2HexN(SPtr,4));ππ  Writeln('Result: ',Int2HexN(P1($12345678,$87654321),8));π  P2;π  P3(Data);ππ  Dpmi_SetAccessRights(Sel,Oldright);π  Dpmi_SetSelectorLimit(Dsel,$FFFF);π  GlobalfreePtr(Data);πEnd.ππ                                            25     05-26-9407:31ALL                      MICHAEL VINCZE           New EXE Headers          IMPORT              104    Kx   (*πIn article 767298319@stimpy.cs.iastate.edu, james@cs.iastate.edu (James N. Potts) writes:π>I know that if you place {$D string} in a program, the string will be placedπ>into the executable.  Is there an easy way to find this information, or doπ>you have to do a search through the file?ππThere are a few ways.  Screen savers use this information, so one wayπto do it is to rename your file *.scr, place it in the windows directory,πand then look at it from the control panel as you are selecting a screenπsaver.  Yeach!  Another way is to use a file dumper (?) such asπTDUMP by Borland or EXEHDR by Microsoft.  These programs will give youπthe pertinent information.  TDUMP by the way comes with BP 7.0.ππProgrammaticly you can obtain the string through the new executableπfile header information.  The string you are interested in is theπfirst entry in the nonresident-name table.  If you do not specifyπ{$D string} then this string will be the file name (like myfile.EXE).ππA few days ago I posted how to do certain things with the new executableπfile header.  You may want to look back a few days on your news readerπto get some insight.  But don't dispare.  I will give some clues here.ππThe first thing to do is to read the new EXE file format foundπin the Borland or Micrsoft help files.  For Borland it canπbe found under the "File Formats" topic.ππNext you should get the EXE header types.  This can be obtainedπat ftp.microsoft.com (filename: newexe12.zip).  I haveπincluded a Pascal version at the end of this missive.ππNow in your program you need to do the following:ππ  1.  Determine if the file is of the new EXE type.π  2.  Get the address of the non-resident name table.π  3.  Read the first string in the non-resident name table.ππLater in this missive you will find a function that does step 1.πBelow are the stepsπ*)ππusesπ  WinCrt,π  WinTypes,π  WinProcs;ππconstπ  fn: PChar = 'c:\bp\myprog\myprog.exe';ππtypeπ  DosHdr           : IMAGE_DOS_HEADER;π  NewHdr           : IMAGE_NEW_HEADER;π  ModuleDescription: rsrc_string;π  Filehandle       : Integer;π  ofs              : TOFSTRUCT;ππlabelπ  Return;ππbeginπif not IsNewExe (fn, DosHdr, NewHdr) then goto Return;ππFillChar (ofs, sizeof (TOFSTRUCT), 0);πif OpenFile (fn, ofs, OF_EXIST or OF_READ) = -1 then goto Return;ππFileHandle := OpenFile (fn, ofs, OF_REOPEN or OF_READ);πif FileHandle = -1 then goto Return;ππ{ goto location of non-resident name table }π_llseek (FileHandle, DosHdr.e_lfanew + NewHdr.ne_nrestab, 0);ππ{ read length of string (in first entry of the non-resident name table) }π_lread (FileHandle, @ModuleDescription.rs_len, sizeof (Byte));ππ{ allocate space for string }πGetMem (ModuleDescription.rs_string, ModuleDescription.rs_len + 1);ππ{ read module description string }π_lread (FileHandle, @ModuleDescription.rs_string, ModuleDescription.rs_len);ππ{ tag null termination onto string }πModuleDescription.rs_string[ModuleDescription.rs_len] := #0;ππ{ write results }πwriteln (fn, ' Module Description: ', ModuleDescription.rs_string);ππ{ dispose of string }πFreeMem (ModuleDescription.rs_string, ModuleDescription.rs_len + 1);ππReturn:π{ close file }π_lclose (FileHandle);πend.πππNote that the above code is only good for finding the first stringπin the non-resident name table as the rest of the table also includesπindex numbers as wll as the string length and the string.  This codeπhas also not been tested.ππI hope you get some mileage from it.ππ-Michael Vinczeπvincze@lobby.ti.comππ---------- NEW EXE HEADER TYPES ----------ππtypeπ  IMAGE_DOS_HEADER = record     { DOS 1, 2, 3 .EXE header     }π    e_magic   : Word;     { Magic number                      }π    e_cblp    : Word;     { Words on last page of file        }π    e_cp      : Word;     { Pages in file                     }π    e_crlc    : Word;     { Relocations                       }π    e_cparhdr : Word;     { Size of header in paragraphs      }π    e_minalloc: Word;     { Minimum extra paragraphs needed   }π    e_maxalloc: Word;     { Maximum extra paragraphs needed   }π    e_ss      : Word;     { Initial (relative) SS value       }π    e_sp      : Word;     { Initial SP value                  }π    e_csum    : Word;     { Checksum                          }π    e_ip      : Word;     { Initial IP value                  }π    e_cs      : Word;     { Initial (relative) CS value       }π    e_lfarlc  : Word;     { File address of relocation table  }π    e_ovno    : Word;     { Overlay number                    }π    e_res     : array[0..3] of Word;  { Reserved words        }π    e_oemid   : Word;     { OEM identifier (for e_oeminfo)    }π    e_oeminfo : Word;     { OEM information; e_oemid specific }π    e_res2    : array[0..9] of Word;  { Reserved words        }π    e_lfanew  : Longint;  { File address of new exe header    }π    end;ππconstπ  IMAGE_DOS_SIGNATURE    = $00005A4D; { MZ    }π  IMAGE_OS2_SIGNATURE    = $0000454E; { NE    }π  IMAGE_OS2_SIGNATURE_LE = $00005A4D; { LE    }π  IMAGE_NT_SIGNATURE     = $00004550; { PE00  }ππtypeπ  IMAGE_NEW_HEADER = record { New .EXE header                       }π    ne_magic      : Word;     { Magic number NE_MAGIC               }π    ne_ver        : Byte;     { Version number                      }π    ne_rev        : Byte;     { Revision number                     }π    ne_enttab     : Word;     { Offset of Entry Table               }π    ne_cbenttab   : Word;     { Number of bytes in Entry Table      }π    ne_crc        : Longint;  { Checksum of whole file              }π    ne_flags      : Word;     { Flag word                           }π    ne_autodata   : Word;     { Automatic data segment number       }π    ne_heap       : Word;     { Initial heap allocation             }π    ne_stack      : Word;     { Initial stack allocation            }π    ne_csip       : Longint;  { Initial CS:IP setting               }π    ne_sssp       : Longint;  { Initial SS:SP setting               }π    ne_cseg       : Word;     { Count of file segments              }π    ne_cmod       : Word;     { Entries in Module Reference Table   }π    ne_cbnrestab  : Word;     { Size of non-resident name table     }π    ne_segtab     : Word;     { Offset of Segment Table             }π    ne_rsrctab    : Word;     { Offset of Resource Table            }π    ne_restab     : Word;     { Offset of resident name table       }π    ne_modtab     : Word;     { Offset of Module Reference Table    }π    ne_imptab     : Word;     { Offset of Imported Names Table      }π    ne_nrestab    : Longint;  { Offset of Non-resident Names Table  }π    ne_cmovent    : Word;     { Count of movable ent                }π    ne_align      : Word;     { Segment alignment shift count       }π    ne_cres       : Word;     { Count of resource entries           }π    ne_exetyp     : Byte;     { Target operating system             }π    ne_flagsothers: Byte;     { Other .EXE flags                    }π    ne_res        : array [0..7] of Byte; { Pad structure to 64 bytes }π    end;ππconst { Format of ne_exetyp (target operating system) }π  NE_UNKNOWN = $0;  { Unknown (any "new-format" OS) }π  NE_OS2     = $1;  { Microsoft/IBM OS/2            }π  NE_WINDOWS = $2;  { Microsoft Windows             }π  NE_DOS4    = $3;  { Microsoft MS-DOS 4.x          }π  NE_DEV386  = $4;  { Microsoft Windows 386         }ππconst { Format of IMAGE_NEW_HEADER.ne_flags                     }π  NENOTP         = $8000; { Not a process                       }π  NEIERR         = $2000; { Errors in image                     }π  NEBOUND        = $0800; { Bound as family app                 }π  NEAPPTYP       = $0700; { Application type mask               }π  NENOTWINCOMPAT = $0100; { Not compatible with P.M. Windowing  }π  NEWINCOMPAT    = $0200; { Compatible with P.M.                }π  NEWINAPI       = $0300; { Uses P.M. Windowing API             }π  NEFLTP         = $0080; { Floating-point instructions         }π  NEI386         = $0040; { 386 instructions                    }π  NEI286         = $0020; { 286 instructions                    }π  NEI086         = $0010; { 8086 instructions                   }π  NEPROT         = $0008; { Runs in protected mode only         }π  NEPPLI         = $0004; { Per-Process Library Initialization  }π  NEINST         = $0002; { Instance data                       }π  NESOLO         = $0001; { Solo data                           }ππtypeπ  new_seg = record  { New .EXE segment table entry        }π    ns_sector  : Word;  { File sector of start of segment }π    ns_cbseg   : Word;  { Number of bytes in file         }π    ns_flags   : Word;  { Attribute flags                 }π    ns_minalloc: Word;  { Minimum allocation in bytes     }π    end;ππconst { Format of new_seg.nsflags                                                 }π  NSCODE    = $0000;  { Code segment                                              }π  NSDATA    = $0001;  { Data segment                                              }π  NSLOADED  = $0004;  { ns_sector field contains memory addr                      }π  NSTYPE    = $0007;  { Segment type mask                                         }π  NSITER    = $0008;  { Iterated segment flag                                     }π  NSMOVE    = $0010;  { Movable segment flag                                      }π  NSSHARED  = $0020;  { Shared segment flag                                       }π  NSPRELOAD = $0040;  { Preload segment flag                                      }π  NSEXRD    = $0080;  { Execute-only (code segment), or  read-only (data segment) }π  NSRELOC   = $0100;  { Segment has relocations                                   }π  NSCONFORM = $0200;  { Conforming segment                                        }π  NSDISCARD = $1000;  { Segment is discardable                                    }π  NS32BIT   = $2000;  { 32-bit code segment                                       }π  HSHUGE    = $4000;  { Huge memory segment                                       }π  NSEXPDOWN = $0200;  { Data segment is expand down                               }ππ(*π#define NSDPL   0x0C00    /* I/O privilege level (286 DPL bits) */π#define SHIFTDPL  10    /* Left shift count for */π#define NSPURE    NSSHARED  /* For compatibility */π#define NSALIGN 9 /* Segment data aligned on 512 byte boundaries */π*)ππtypeπ  new_rlcinfo = record  { Relocation info                       }π    nr_nreloc: Word;  { number of relocation items that follow  }π    end;ππtypeπ  new_rlc = record  { Relocation item }π    nr_stype: Byte; { Source type     }π    nr_flags: Byte; { Flag byte       }π    nr_soff : Word; { Source offset   }π    case Integer ofπ      0: (nr_segno : Byte;  { Target segment number             } { internal reference      }π          nr_res   : Byte;  { Reserved                          }π          nr_entry : Word); { Target Entry Table offset         }π      1: (nr_mod   : Word;  { Index into Module Reference Table } { import                  }π          nr_proc  : Word); { Procedure ordinal or name offset  }π      2: (nr_ostype: Word;  { OSFIXUP type                      } { operating system fixup  }π          nr_osres : Word); { Reserved                          }π    end;ππ{ Resource type or name stringπ}πtypeπ  rsrc_string = recordπ    rs_len   : Byte;  { number of bytes in string }π    rs_string: PChar; { text of string            }π    end;πππ---------- IsNewExe() function ----------ππBelow is the code to determine if the file is of the new EXE type.πNote how DosHdr and NewHdr are passed by reference and not by value.πThis is so values for DosHdr and NewHdr can be used by otherπfunctions called by the main program.  Also note the extensive useπof the OpenFile(), _lread(), _llseek(), and _lclose() functions.ππ  function IsNewExe (fn: PChar;π                     var DosHdr: IMAGE_DOS_HEADER;π                     var NewHdr: IMAGE_NEW_HEADER): Boolean;π  labelπ    Return;π  varπ    Filehandle: Integer;π    BytesRead : Integer;π    ofs       : TOFSTRUCT;π  beginπ  IsNewExe := False;ππ  FillChar (ofs, sizeof (TOFSTRUCT), 0);π  if OpenFile (fn, ofs, OF_EXIST or OF_READ) = -1 then goto Return;ππ  FileHandle := OpenFile (fn, ofs, OF_REOPEN or OF_READ);π  if FileHandle = -1 then goto Return;ππ  FillChar (DosHdr, sizeof (IMAGE_DOS_HEADER), 0);π  FillChar (NewHdr, sizeof (IMAGE_NEW_HEADER), 0);ππ  { read MS-DOS header }π  BytesRead := _lread (FileHandle, @DosHdr, sizeof (IMAGE_DOS_HEADER));ππ  { test for bytes read }π  if BytesRead <> sizeof (IMAGE_DOS_HEADER) then goto Return;ππ  { test for magic number MZ }π  if DosHdr.e_magic <> IMAGE_DOS_SIGNATURE then goto Return;ππ  { test for address of new exe header }π  if DosHdr.e_lfanew <= 0 then goto Return;ππ  { fast forward to Windows header }π  if _llseek (FileHandle, DosHdr.e_lfanew, 0) = -1 then goto Return;ππ  { read new exe header }π  BytesRead := _lread (FileHandle, @NewHdr, sizeof (IMAGE_NEW_HEADER));ππ  { test for bytes read }π  if BytesRead <> sizeof (IMAGE_NEW_HEADER) then goto Return;ππ  { test for signature NE }π  if NewHdr.ne_magic <> IMAGE_OS2_SIGNATURE then goto Return;ππ  { passed the test }π  IsNewExe := True;ππ  Return:π  { close file }π  _lclose (FileHandle);π  end;ππ                  26     05-26-9410:57ALL                      DANIEL THOMAS            Center Dialog            IMPORT              29     Kx   Unit Center;π{**************************************************************************}π{*    Center   by Daniel Thomas  CIS 72301,2164                           *}π{*                                                                        *}π{*  This code is hereby donated to the public domain.  Enjoy.             *}π{*                                                                        *}π{*  This unit contains a procedure, CenterPopup, which will center a      *}π{*  Popup window (i.e. a dialog) in it's parent's window.  If it won't    *}π{*  fit inside the parent's window, then it will be centered on top of    *}π{*  the parent.                                                           *}π{*                                                                        *}π{*  Also, if the dialog would be positioned off the screen, it is forced  *}π{*  within the visible screen.                                            *}π{*                                                                        *}π{*  There are a few descendant objects - tCenteredDialog and              *}π{*  tCenteredInputDialog - that make using it a snap.  Just replace an    *}π{*  occurrance of pDialog with pCenteredDialog, and you've got a centered *}π{*  dialog!                                                               *}π{**************************************************************************}ππInterfaceππUSES WinTypes,WinProcs,WObjects,StdDlgs;ππTypeπ  pInteger=^integer;ππ  pCenteredDialog=^tCenteredDialog;π  tCenteredDialog=object(tDialog)π      Procedure SetupWindow; virtual;π    end;ππ  pCenteredInputDialog=^tCenteredInputDialog;π  tCenteredInputDialog=object(tInputDialog)π      Procedure SetupWindow; virtual;π    end;ππProcedure CenterPopup(aPopup,aParent: hWnd);ππImplementationππProcedure CenterPopup(aPopup,aParent: hWnd);ππvarπ  PopupR,ParentR  : tRect;π  ScreenW,ScreenH : integer;π  x,y,π  PopupW,PopupH,π  ParentW,ParentH : word;ππ  procedure SetupValues(Wnd: hWnd; var R: tRect; var W,H : word);π    beginπ      GetWindowRect(Wnd,R);π      W := R.Right-R.Left;π      H := R.Bottom-R.Top;π    end; {SetupValues}ππ  procedure SetupLocation(PopupSize,ScreenSize,ParentSize,ParentStart : word;π                          var PopupStart: word);π    beginπ      if PopupSize > ScreenSize thenπ        PopupStart := 0π      elseπ        beginπ          if PopupSize <= ParentSize thenπ            PopupStart := ParentStart+((ParentSize-PopupSize) div 2)π          elseπ            PopupStart := ParentStart-((PopupSize-ParentSize) div 2);π          if PopupStart > ScreenSize thenπ            PopupStart := 0π          elseπ          if PopupStart+PopupSize > ScreenSize thenπ            PopupStart := ScreenSize-PopupSize;π        end;π    end; {SetupLocation}ππbegin {CenterPopup}π  ScreenW := GetSystemMetrics(sm_CXScreen);π  ScreenH := GetSystemMetrics(sm_CYScreen);π  SetupValues(aPopup,PopupR,PopupW,PopupH);π  SetupValues(aParent,ParentR,ParentW,ParentH);π  SetupLocation(PopupW,ScreenW,ParentW,ParentR.Left,x);π  SetupLocation(PopupH,ScreenH,ParentH,ParentR.Top,y);π  MoveWindow(aPopup,x,y,PopupW,PopupH,false);πend; {CenterPopup}ππProcedure tCenteredDialog.SetupWindow;ππbeginπ  tDialog.SetupWindow;π  CenterPopup(HWindow, Parent^.HWindow);πend; {tAniOptionsDialog.SetupWindow}ππProcedure tCenteredInputDialog.SetupWindow;ππbeginπ  tInputDialog.SetupWindow;π  CenterPopup(HWindow, Parent^.HWindow);πend; {tAniOptionsDialog.SetupWindow}ππππend.π                                                                                                                  27     05-26-9411:03ALL                      RON AARON                NO multiple instances    IMPORT              9      Kx   program Instances;π{ uploaded by Ron Aaron as a demonstration of how toπ  prevent multiple instances of a program in differentπ  VMs.  This program will work compiled for Windows, DOSπ  or DPMI.π}πuses  strings,π{$IFDEF WINDOWS}π        wincrtπ{$ELSE}π       crtπ{$ENDIF}π;ππvarπ   { Inter Program Area: 16 bytes set aside by IBM forπ     just this sort of thing...π   }π   IPA : array[0..15] of char absolute $40:$f0;ππconstπ   ident : PChar = 'INSTTEST';ππfunction isrunning : boolean;πbeginπ     if StrComp(IPA, ident) = 0 thenπ        isrunning := trueπ     elseπ        isrunning := false;πend;ππprocedure install;πbeginπ     StrCopy(IPA, ident);πend;ππprocedure deinstall;πbeginπ     StrCopy(IPA,'xxxxx');πend;ππbeginπ     if isrunning thenπ     beginπ          writeln('Previous copy is running.');π     endπ     elseπ     beginπ          install;π          writeln('No previous copy is running.  Press any key to quit...');π          while not keypressed doπ                ;π          deinstall;π     end;πend.