注册机源代码!(Delphi 6 + WinXP Pro 下调试通过),未作特殊情况处理. (1千字)
unit Unit1;interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Button1: TButton;
Button2: TButton;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Machinecode,N,Tmp,i:Integer;
Tmpstr,tmpstr1,tmpstr2:String;
begin
Machinecode:=StrToInt(Edit1.Text);
Tmpstr1:=IntToStr(85798-(Machinecode - Machinecode mod 10) div 10);
Tmpstr2:='85798';
for i:=1 to 5 do
Tmpstr:=Tmpstr+Tmpstr1[i]+Tmpstr2[i]+'1';
Tmpstr:=Tmpstr+'212';
Tmp:=0;
for i:=1 to 18 do
Tmp:=Tmp+StrToInt(Tmpstr[i]) *3;
Tmpstr:=Tmpstr+'1'+IntToStr(Tmp mod 10)+'11111111111';
N:=1;
Tmpstr1:='';
for i:=65 to 84 do
if StrToInt(copy(Tmpstr,N,2))+i<=90 then
begin
Tmpstr1:=Tmpstr1+chr(StrToInt(copy(Tmpstr,N,2))+i);
N:=N+2;
end
else begin
Tmpstr1:=Tmpstr1+chr(StrToInt(copy(Tmpstr,N,1))+i);
N:=N+1;
end;
edit2.text:=Tmpstr1[20]+Tmpstr1[18]+Tmpstr1[16]+Tmpstr1[14]+Tmpstr1[12]+'-'
+Tmpstr1[10]+Tmpstr1[8]+Tmpstr1[6]+Tmpstr1[4]+Tmpstr1[2]+'-'
+Tmpstr1[19]+Tmpstr1[17]+Tmpstr1[15]+Tmpstr1[13]+Tmpstr1[11]+'-'
+Tmpstr1[9]+Tmpstr1[7]+Tmpstr1[5]+Tmpstr1[3]+Tmpstr1[1];
end;
end.
