home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 April A / Pcwk4a98.iso / PROGRAM / DELPHI16 / Format / ABOUT.PAS < prev    next >
Pascal/Delphi Source File  |  1995-06-04  |  3KB  |  107 lines

  1. unit About;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, ExtCtrls, Buttons, Register, Label3d;
  8.  
  9. type
  10.   TAboutBox = class(TForm)
  11.     Panel1: TPanel;
  12.     ProgramIcon: TImage;
  13.     Panel2: TPanel;
  14.     Label7: TLabel;
  15.     WinVersion: TLabel;
  16.     Label8: TLabel;
  17.     DosVersion: TLabel;
  18.     Label9: TLabel;
  19.     Coprocessor: TLabel;
  20.     Label10: TLabel;
  21.     CPU: TLabel;
  22.     Label11: TLabel;
  23.     FreeMemory: TLabel;
  24.     Label12: TLabel;
  25.     FreeResources: TLabel;
  26.     Label13: TLabel;
  27.     FreeDisk: TLabel;
  28.     BitBtn1: TBitBtn;
  29.     BitBtn2: TBitBtn;
  30.     ProgramName: TLabel3D;
  31.     Version: TLabel3D;
  32.     Label3D1: TLabel3D;
  33.     Label3D2: TLabel3D;
  34.     Label3D3: TLabel3D;
  35.     Label3D4: TLabel3D;
  36.     procedure BitBtn2Click(Sender: TObject);
  37.     procedure BitBtn1Click(Sender: TObject);
  38.     procedure FormCreate(Sender: TObject);
  39.   private
  40.     { Private declarations }
  41.     fileHandle: THandle;
  42.     fileBuffer: Array [0..29] of Char;
  43.     wVersion: Word;
  44.     dVersion: Word;
  45.     winFlags: LongInt;
  46.   public
  47.     { Public declarations }
  48.   end;
  49.  
  50. var
  51.   AboutBox: TAboutBox;
  52.  
  53. implementation
  54.  
  55. {$R *.DFM}
  56.  
  57. procedure TAboutBox.BitBtn2Click(Sender: TObject);
  58. begin
  59. RegisterDlg.Show
  60. end;
  61.  
  62. procedure TAboutBox.BitBtn1Click(Sender: TObject);
  63. begin
  64.    Close;
  65. end;
  66.  
  67. procedure TAboutBox.FormCreate(Sender: TObject);
  68. begin
  69.     {Get program icon}
  70.     ProgramIcon.Picture.Graphic := Application.Icon;
  71.     {Set Aboutbox Program Name & Version}
  72.     AboutBox.ProgramName.Caption := ExtractFileName(Application.EXEName);
  73.     AboutBox.Version.Caption := 'Version 1.0';
  74.     { Get Win/Dos version numbers }
  75.     wVersion := LoWord(GetVersion);
  76.     dVersion := HiWord(GetVersion);
  77.     AboutBox.WinVersion.Caption := IntToStr(LO(wVersion)) + '.' +
  78.                                    IntToStr(HI(wVersion));
  79.     AboutBox.DosVersion.Caption := IntToStr(HI(dVersion)) + '.' +
  80.                                    IntToStr(LO(dVersion));
  81.  
  82.     winFlags := GetWinFlags;
  83.  
  84.     { Get math coprocessor status }
  85.     if winFlags and WF_80x87 > 0 then
  86.         AboutBox.Coprocessor.Caption := 'Present'
  87.     else
  88.         AboutBox.Coprocessor.Caption := 'Not Present';
  89.  
  90.     { Get CPU type }
  91.      if winFlags and WF_CPU486 > 0 then
  92.         AboutBox.CPU.Caption := '486';
  93.      if winFlags and WF_CPU386 > 0 then
  94.         AboutBox.CPU.Caption := '386';
  95.      if winFlags and WF_CPU286 > 0 then
  96.         AboutBox.CPU.Caption := '286';
  97.  
  98.      { Get free memory, resources, disk space }
  99.      AboutBox.FreeMemory.Caption := IntToStr(GetFreeSpace(0) div 1000) + ' KB';
  100.      AboutBox.FreeResources.Caption := IntToStr(GetFreeSystemResources(GFSR_SYSTEMRESOURCES))
  101.                                        + '%';
  102.      AboutBox.FreeDisk.Caption := IntToStr(DiskFree(0) div 1000000) + ' MB';
  103.  
  104. end;
  105.  
  106. end.
  107.