home *** CD-ROM | disk | FTP | other *** search
/ Guide To Cracking 2002 / Guide_to_Cracking_2002.iso / Programming / yPP-B-SRC.ZIP / Unit4.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-08-30  |  2.1 KB  |  90 lines

  1. unit Unit4;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, Buttons, ExtCtrls,shellapi,d32lib,hexfun;
  8.  
  9. type
  10.   Toptionform = class(TForm)
  11.     GroupBox1: TGroupBox;
  12.     Edit1: TEdit;
  13.     GroupBox2: TGroupBox;
  14.     SpeedButton1: TSpeedButton;
  15.     GroupBox3: TGroupBox;
  16.     RadioButton1: TRadioButton;
  17.     RadioButton2: TRadioButton;
  18.     Image1: TImage;
  19.     OpenDialog1: TOpenDialog;
  20.     procedure FormShow(Sender: TObject);
  21.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  22.     procedure GroupBox2Click(Sender: TObject);
  23.     procedure SpeedButton1Click(Sender: TObject);
  24.   private
  25.     { Private-Deklarationen }
  26.   public
  27.   end;
  28.  
  29. var
  30.   optionform  : Toptionform;
  31.  
  32. implementation
  33.  
  34. uses Unit1;
  35.  
  36. {$R *.DFM}
  37.  
  38. procedure Toptionform.FormShow(Sender: TObject);
  39. begin
  40. form1.enabled:=false;
  41. // show the currently selected icon
  42. optionform.image1.Picture.icon:=theico;
  43. end;
  44.  
  45. procedure Toptionform.FormClose(Sender: TObject; var Action: TCloseAction);
  46. begin
  47. form1.enabled:=true;
  48. end;
  49.  
  50. procedure Toptionform.GroupBox2Click(Sender: TObject);
  51. begin
  52. opendialog1.filename:='';
  53. if opendialog1.execute then
  54.   begin
  55.    tmpico.Handle:=ExtractIcon(hInstance,pchar(opendialog1.filename),0);
  56.    if tmpico.handle <> 0 then
  57.      begin
  58.      if (tmpico.Width <> 32) or (tmpico.Height <> 32) then // check the icon format
  59.        begin
  60.        mb('Invalid icon format !',':(',mb_iconerror);
  61.        theico.handle:=0;
  62.        exit;
  63.        end;
  64.      theico.free;
  65.      theico:=ticon.create;
  66.      theico.handle:=tmpico.handle;
  67.      optionform.image1.Picture.icon:=theico;
  68.      end
  69.      else mb('Unable to extract the Icon !',':(',mb_iconerror);
  70.   end;
  71. end;
  72.  
  73. procedure Toptionform.SpeedButton1Click(Sender: TObject);
  74. begin
  75. // check the attack num
  76. if not ishexnum(edit1.text) then
  77.   begin
  78.   mb('The Attack Number is an invalid hex number !',':(',mb_iconerror);
  79.   exit;
  80.   end;
  81. if hex2int(edit1.text) = 0 then
  82.   begin
  83.   mb('The Attack Number can''t be 0 !',':(',mb_iconerror);
  84.   exit;
  85.   end;
  86. close;
  87. end;
  88.  
  89. end.
  90.