Registriert seit: 23. Jul 2015
42 Beiträge
|
AW: Exception bei FMX IntputBox
14. Dez 2015, 10:13
Oh, Sorry
Ich meinte dass der Code Schnipsel genug Info währe.
Der Vollständigkeit halber dann hier der ganze Code.
Delphi-Quellcode:
function TMiniDOForm.DecodeSpecialCode : Longint;
var
CodeStr : string;
ModKey : TKey;
MachineID : string;
Modifier : longint;
begin
Result := 0;
MachineID := '';
Modifier := GenerateMachineModifierPrim;
MachineID := BufferToHex(Modifier, SizeOf(Modifier));
ModKey := TheKey;
ApplyModifierToKeyPrim(Modifier, ModKey, SizeOf(ModKey));
{First see if existing Special code is valid}
if IsSpecialCodeValid(ModKey, SpecialCode) then begin
Result := GetSpecialCodeValue(ModKey, SpecialCode);
Exit;
end;
{Otherwise prompt user for Special code}
CodeStr := '';
{$IFDEF MSWINDOWS}
if InputQuery('Machine ID: '+ MachineID ,
'Release Code', CodeStr) then begin
HexToBuffer(CodeStr, SpecialCode, SizeOf(SpecialCode));
if IsSpecialCodeValid(ModKey, SpecialCode) then
Result := GetSpecialCodeValue(ModKey, SpecialCode);
end;
{$ENDIF MSWINDOWS}
{$IFDEF ANDROID}
InputBox('Machine ID: '+ MachineID, 'Release Code',CodeStr,
procedure(const AResult: TModalResult; const AValue: string)
begin
case AResult of
mrOk:
begin
// AValue is the result of the inputbox dialog
HexToBuffer(AValue, SpecialCode, SizeOf(SpecialCode));
if IsSpecialCodeValid(ModKey, SpecialCode) then
Result := GetSpecialCodeValue(ModKey, SpecialCode);
end;
mrCancel:
begin
end;
end;
end
);
{$ENDIF ANDROID}
end;
|
|
Zitat
|