home *** CD-ROM | disk | FTP | other *** search
- unit Unit4;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, Buttons, ExtCtrls,shellapi,d32lib,hexfun;
-
- type
- Toptionform = class(TForm)
- GroupBox1: TGroupBox;
- Edit1: TEdit;
- GroupBox2: TGroupBox;
- SpeedButton1: TSpeedButton;
- GroupBox3: TGroupBox;
- RadioButton1: TRadioButton;
- RadioButton2: TRadioButton;
- Image1: TImage;
- OpenDialog1: TOpenDialog;
- procedure FormShow(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure GroupBox2Click(Sender: TObject);
- procedure SpeedButton1Click(Sender: TObject);
- private
- { Private-Deklarationen }
- public
- end;
-
- var
- optionform : Toptionform;
-
- implementation
-
- uses Unit1;
-
- {$R *.DFM}
-
- procedure Toptionform.FormShow(Sender: TObject);
- begin
- form1.enabled:=false;
- // show the currently selected icon
- optionform.image1.Picture.icon:=theico;
- end;
-
- procedure Toptionform.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- form1.enabled:=true;
- end;
-
- procedure Toptionform.GroupBox2Click(Sender: TObject);
- begin
- opendialog1.filename:='';
- if opendialog1.execute then
- begin
- tmpico.Handle:=ExtractIcon(hInstance,pchar(opendialog1.filename),0);
- if tmpico.handle <> 0 then
- begin
- if (tmpico.Width <> 32) or (tmpico.Height <> 32) then // check the icon format
- begin
- mb('Invalid icon format !',':(',mb_iconerror);
- theico.handle:=0;
- exit;
- end;
- theico.free;
- theico:=ticon.create;
- theico.handle:=tmpico.handle;
- optionform.image1.Picture.icon:=theico;
- end
- else mb('Unable to extract the Icon !',':(',mb_iconerror);
- end;
- end;
-
- procedure Toptionform.SpeedButton1Click(Sender: TObject);
- begin
- // check the attack num
- if not ishexnum(edit1.text) then
- begin
- mb('The Attack Number is an invalid hex number !',':(',mb_iconerror);
- exit;
- end;
- if hex2int(edit1.text) = 0 then
- begin
- mb('The Attack Number can''t be 0 !',':(',mb_iconerror);
- exit;
- end;
- close;
- end;
-
- end.
-