const
DLLFile = '.\HardwareID.DLL';
var
Form1: TForm1;
procedure SetLicenseKey(Regcode: PAnsiChar); stdcall; external DLLFile;
procedure SetAppName(AppName: PAnsiChar); stdcall; external DLLFile;
function GetHardwareId(HDD, NIC, CPU, BIOS: LongBool; lpHWID: PAnsiChar; nMaxCount: Integer): Integer; stdcall; external DLLFile;
function GetDllVer(lpVersion: PAnsiChar; nMaxCount: Integer): Integer; stdcall; external DLLFile;
function IsInsideVMWare(): Integer; stdcall; external DLLFile;
function IsInsideVirtualPC(): Integer; stdcall; external DLLFile;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
sVer: array[0..254] of AnsiChar;
begin
GetDllVer(sVer, SizeOf(sVer));
Self.Caption:= Format('AzSDK HardwareId DLL [%s] DEMO', [sVer]);
SetLicenseKey('Your-License-Key');
if IsInsideVMWare = 1 then
labIsVMware.Caption:= 'Yes';
if IsInsideVirtualPC = 1 then
labIsVirtualPC.Caption:= 'Yes';
end;
procedure TForm1.btnGetClick(Sender: TObject);
var
sHWID: array[0..254] of AnsiChar;
iRtn: Integer;
begin
SetAppName('');
iRtn:= GetHardwareId(cbHDD.Checked, cbNIC.Checked, cbCPU.Checked, cbBIOS.Checked, sHWID, SizeOf(sHWID));
if iRtn > 0 then
Edit0.Text := sHWID;
end;
procedure TForm1.btnGetWithAppClick(Sender: TObject);
var
sHWID: array[0..254] of AnsiChar;
iRtn: Integer;
sAppName: String;
begin
//Set your application name
sAppName:= Edit1.Text;
SetAppName(PAnsiChar(sAppName));
iRtn:= GetHardwareId(cbHDD.Checked, cbNIC.Checked, cbCPU.Checked, cbBIOS.Checked, sHWID, SizeOf(sHWID));
if iRtn > 0 then
Edit2.Text := sHWID;
end;