unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, WinlicenseSDK, SecureEngineSDK;
type
TForm2 = class(TForm)
Memo1: TMemo;
Check: TButton;
NameEdit: TEdit;
CompanyEdit: TEdit;
ExtradataEdit: TEdit;
HardwareIdEdit: TEdit;
procedure CheckClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.CheckClick(Sender: TObject);
begin
if WLRegNormalKeyCheck(PAnsiChar(AnsiString(memo1.Text))) = false then
MessageBox(0, 'The key that you entered is invalid. Please, try it again', 'Error', MB_OK or MB_ICONERROR)
else
begin
// if activation is valid, insert the registration info in a file
// So, winlicense will be able to finish the registration process
WLRegNormalKeyInstallToFile(PAnsiChar(AnsiString(memo1.Text)));
MessageBox(0, 'Registration key is correct. Please, restart this application to finish the registration process', 'Success', MB_OK);
end;
end;
procedure TForm2.FormCreate(Sender: TObject);
var
Name : ARRAY[0..200] of AnsiChar;
Company : ARRAY[0..200] of AnsiChar;
ExtraData : ARRAY[0..200] of AnsiChar;
MachineId: ARRAY [0..100] of AnsiChar;
ExtStatus: Integer;
begin
EncodeStart();
WLHardwareGetID(MachineId);
HardwareIdEdit.Text := MachineId;
if WLRegGetStatus(ExtStatus) = 1 then
begin
WLRegGetLicenseInfo(Name, Company, ExtraData);
NameEdit.Text := Name;
CompanyEdit.Text := Company;
ExtradataEdit.Text := ExtraData;
end;
EncodeEnd();
end;
end.