📄 softreg.pas
字号:
unit SoftReg;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Registry, GetCPUID, BiosHelp, md5;
type
TFmSoftReg = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
StaticText1: TStaticText;
BitBtnOK: TBitBtn;
BitBtnEsc: TBitBtn;
Txt: TStaticText;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
Function GetMachineCode: String;
Function GetSNFromMCode(MCode: String): String;
procedure Edit1Change(Sender: TObject);
procedure BitBtnOKClick(Sender: TObject);
procedure BitBtnEscClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FmSoftReg: TFmSoftReg;
REG: TRegistry;
implementation
{$R *.dfm}
procedure TFmSoftReg.FormClose(Sender: TObject; var Action: TCloseAction);
begin
//REG.Free;
Close;
//Action := cafree;
//FmSoftReg := Nil;
end;
procedure TFmSoftReg.FormCreate(Sender: TObject);
begin
REG := TRegistry.create;
StaticText1.Caption := GetMachineCode;
end;
Function TFmSoftReg.GetMachineCode: String;
Var
ID1, ID2 : String;
Begin
ID1 := GetCPUID.CpuData.GetCPUID;
ID2 := BiosHelp.GetmotherboradKey;
result := Copy(MD5Print(MD5String(ID1 + ID2)), 0, 8);
End;
Function TFmSoftReg.GetSNFromMCode(MCode: String): String;
Begin
result := MD5Print(MD5String(MCode));
End;
procedure TFmSoftReg.Edit1Change(Sender: TObject);
begin
BitBtnOK.Enabled := Length(Edit1.Text) > 0;
end;
procedure TFmSoftReg.BitBtnOKClick(Sender: TObject);
Var
SN : String;
Begin
SN := GetSNFromMCode(StaticText1.Caption);
If StrComp(pchar(SN), pchar(Edit1.Text)) = 0 Then Begin
REG.RootKey := HKEY_LOCAL_MACHINE;
REG.OpenKey('SOFTWARE\RedStudio', true);
REG.WriteInteger('Powers', 2005);
Txt.Caption := '注册成功!' + '请妥善保管序列号!';
Application.MessageBox('注册完毕,将关闭程序,请你重新启动程序,谢谢!',
'非正式用户提示!', MB_ICONERROR + mb_OK + MB_SYSTEMMODAL);
Application.Terminate;
End
Else Begin
Txt.Caption := '注册失败!' + #13 +
'请将上面的本机注册码用EMAIL发送到:redleaf02@163.com,索要序列号!';
Edit1.Clear;
Edit1.SetFocus;
BitBtnOK.Enabled := False;
//MainForm.A5.Enabled := true;
End;
End;
procedure TFmSoftReg.BitBtnEscClick(Sender: TObject);
begin
Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -