home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 April A / Pcwk4a98.iso / PROGRAM / DELPHI16 / Calmira / ABOUT.PAS next >
Pascal/Delphi Source File  |  1997-02-15  |  4KB  |  99 lines

  1. {**************************************************************************}
  2. {                                                                          }
  3. {    Calmira shell for Microsoft« Windows(TM) 3.1                          }
  4. {    Source Release 1.0                                                    }
  5. {    Copyright (C) 1997  Li-Hsin Huang                                     }
  6. {                                                                          }
  7. {    This program is free software; you can redistribute it and/or modify  }
  8. {    it under the terms of the GNU General Public License as published by  }
  9. {    the Free Software Foundation; either version 2 of the License, or     }
  10. {    (at your option) any later version.                                   }
  11. {                                                                          }
  12. {    This program is distributed in the hope that it will be useful,       }
  13. {    but WITHOUT ANY WARRANTY; without even the implied warranty of        }
  14. {    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         }
  15. {    GNU General Public License for more details.                          }
  16. {                                                                          }
  17. {    You should have received a copy of the GNU General Public License     }
  18. {    along with this program; if not, write to the Free Software           }
  19. {    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.             }
  20. {                                                                          }
  21. {**************************************************************************}
  22.  
  23. unit About;
  24.  
  25. interface
  26.  
  27. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, StdCtrls,
  28.   Buttons, ExtCtrls;
  29.  
  30. type
  31.   TAboutBox = class(TForm)
  32.     OKButton: TBitBtn;
  33.     LicenseBtn: TBitBtn;
  34.     Image: TImage;
  35.     ProductName: TLabel;
  36.     VersionLabel: TLabel;
  37.     Copyright: TLabel;
  38.     Email: TLabel;
  39.     MemLabel: TLabel;
  40.     ResLabel: TLabel;
  41.     Label2: TLabel;
  42.     Bevel1: TBevel;
  43.     procedure LicenseBtnClick(Sender: TObject);
  44.     procedure FormCreate(Sender: TObject);
  45.   private
  46.     { Private declarations }
  47.   public
  48.     { Public declarations }
  49.   end;
  50.  
  51. {
  52. var
  53.   AboutBox: TAboutBox;
  54. }
  55.  
  56. implementation
  57.  
  58. {$R *.DFM}
  59.  
  60. uses Strings, SysUtils, Files, MiscUtil, Settings, Dialogs;
  61.  
  62. procedure TAboutBox.LicenseBtnClick(Sender: TObject);
  63. var
  64.   license : TFilename;
  65. begin
  66.   license := ApplicationPath + 'LICENSE.TXT';
  67.  
  68.   if not FileExists(license) then
  69.     MsgDialog('Cannot find LICENSE.TXT.  You can obtain a GNU General ' +
  70.       'Public License by writing to the Free Software Foundation Inc., '+
  71.       '675 Mass Ave, Cambridge, MA 02139, USA.', mtWarning, [mbOK], 0)
  72.   else
  73.     if ExecuteFile('notepad.exe', license, '', 'Open', SW_SHOWMAXIMIZED) <= 31 then
  74.     MsgDialog('Unable to run Notepad.  Read LICENSE.TXT with another text editor',
  75.       mtError, [mbOK], 0);
  76. end;
  77.  
  78.  
  79. procedure TAboutBox.FormCreate(Sender: TObject);
  80. begin
  81.   OKButton.Cancel := True;
  82.  
  83.   MemLabel.Caption := Format('Memory:      %s Free', [FormatByte(GetFreeSpace(0))]);
  84.   ResLabel.Caption := Format('Resources:  System %d%%    GDI %d%%    USER %d%%',
  85.     [GetFreeSystemResources(GFSR_SYSTEMRESOURCES),
  86.      GetFreeSystemResources(GFSR_GDIRESOURCES),
  87.      GetFreeSystemResources(GFSR_USERRESOURCES)]);
  88.  
  89.   Image.Picture.Bitmap.Handle := LoadBitmap(HInstance, 'LOGO');
  90.  
  91.   if FirstRun then begin
  92.     Caption := 'Welcome';
  93.     FirstRun := False;
  94.   end;
  95. end;
  96.  
  97. end.
  98.  
  99.