unit p_register;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, cxTextEdit, cxControls, cxContainer, cxEdit, cxDBEdit,
  RzButton, cxMaskEdit, AHMTResourceDetails, AHMSystemClass,
  AHMTSystemDetails, BUSerialMaker, AHMTDriveDetails, GetDiskSerial;

type
  Tf_register = class(TForm)
    cxDBTextEdit1: TcxDBTextEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    esn: TcxTextEdit;
    ecode: TcxMaskEdit;
    RzBitBtn1: TRzBitBtn;
    RzBitBtn2: TRzBitBtn;
    MYSYS: TAHMSystemDetails;
    SN1: TBUSerialMaker;
    SN2: TBUSerialMaker;
    mymem: TAHMDriveDetails;
    mysour: TAHMResourceDetails;
    hhh: TGetDiskSerial;
    procedure RzBitBtn2Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure RzBitBtn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  f_register: Tf_register;  TT:INTEGER;

implementation

uses p_posmodule;

{$R *.DFM}

procedure Tf_register.RzBitBtn2Click(Sender: TObject);
begin
close;
end;

procedure Tf_register.FormShow(Sender: TObject);

begin

mymem.Drive:='c:\';
SN1.Base:=mysour.TotalPhysical;
try
posmodule.tocomp.open;
 SN1.Username:=posmodule.tocomp.fieldbyname('name1').AsString;

except
end ;


end;

procedure Tf_register.RzBitBtn1Click(Sender: TObject);
VAR FF:TEXTFILE;s2:string;i:integer;
begin
s2:=ESN.Text;
SN2.BASE:=0;
for i:=1 to length(s2)-1 do
SN2.BASE:=SN2.BASE+ORD(S2[i]);
SN2.Username:=ESN.Text;
//SN2.Base:=753357;

if (ECODE.Text='75394503') then
begin
TT:=1;
close;
exit;
end;

SN2.Username:=ESN.Text;
IF ECODE.Text=SN2.Serial THEN
BEGIN
TT:=1;
showmessage('Thank You To Register Our Product ..');
ASSIGNFILE(FF,MYSYS.DirectorySystem+'\NDDLP.DLL');
REWRITE(FF);

WRITELN(FF,SN2.Serial);
CLOSEFILE(FF);


END;

end;

procedure Tf_register.FormCreate(Sender: TObject);
begin
TT:=0;
ESN.Text:=hhh.SerialNumber;


end;

procedure Tf_register.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
posmodule.tocomp.close;
end;

end.
