📄 zhuce.pas
字号:
unit zhuce;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls,nb30;
type
TFrmZhuCe = class(TForm)
Panel1: TPanel;
Label1: TLabel;
EdUser: TEdit;
Label2: TLabel;
EdZhuCe: TEdit;
BtnZhuCe: TButton;
Button2: TButton;
GroupBox1: TGroupBox;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BtnZhuCeClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrmZhuCe: TFrmZhuCe;
implementation
uses fun;
{$R *.dfm}
procedure writezhuce(filename:string;zhuce:string);
var
zhucefile:Text;
str:string;
Tlen,iIdex:integer;
begin
AssignFile(zhucefile,filename);
rewrite(zhucefile);
Tlen:=Length(zhuce);
for iIdex:=1 to Tlen do
str:=str+inttostr(ord(zhuce[iIdex]));
writeln(zhucefile,str);
closefile(zhucefile);
end;
procedure TFrmZhuCe.Button2Click(Sender: TObject);
begin
close;
end;
procedure TFrmZhuCe.FormCreate(Sender: TObject);
begin
Eduser.Text:=inttostr(getregid());
end;
procedure TFrmZhuCe.BtnZhuCeClick(Sender: TObject);
var
strUser,strPass,str1,str2,str3:string;
intNum,intchu,intshang,intyu:integer;
charpostion1,charpostion2:integer;
iIdx,iCount:integer;
charset:string;
path:string;
begin
charset:='0123456789-';
strUser:=Eduser.Text;
strpass:=EdZhuCe.Text;
iCount:=0;
for iIdx:=1 to length(strpass) do
begin
if pos(strpass[iIdx],charset)=0 then
begin
MessageDlg('注册码含有非法字符!',mtError,[mbOK],0);
exit;
end;
if strpass[iIdx]='-' then
begin
inc(icount);
if icount=1 then
charpostion1:=iIdx;
if icount=2 then
charpostion2:=iIdx;
end;
end;
if icount<>2 then
begin
MessageDlg('注册码的格式不正确!',mtError,[mbOK],0);
end;
str1:=copy(strpass,1,charpostion1-1);
str2:=copy(strpass,charpostion1+1,charpostion2-charpostion1-1);
str3:=copy(strpass,charpostion2+1,length(strpass)-charpostion2+1);
str1:=copy(str1,2,length(str1)-2);//除去首尾的多余字符。
str3:=copy(str3,1,length(str3)-1);//除去尾部多余字符。
intNum:=strtoint(struser);
intchu:=strtoint(str1);
intshang:=strtoint(str2);
intyu:=strtoint(str3);
if intNum=(intchu*intshang+intyu) then
begin
path:=ExtractFilePath(ParamStr(0));
path:=path+'sl.sl';
writezhuce(path,EdZhuCe.Text);
MessageDlg('注册成功!请重新启动本软件。',mtInformation,[mbOK],0);
close;
end
else
MessageDlg('注册码不正确!',mtWarning,[mbOK],0);
end;
procedure TFrmZhuCe.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action:=cafree;
frmzhuce:=nil;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -