1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
   |  
function TMiniDOForm.DecodeSpecialCode : Longint;
var
  CodeStr   : string;
  ModKey    : TKey;
  MachineID : string;
  Modifier  : longint;
  InputString: string;
 
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) //<---- Ici je recoit l´erreur 
        begin
            case AResult of
            mrOk:
                begin
                  // AValue is the result of the inputbox dialog
                  HexToBuffer(AValue, SpecialCode, SizeOf(SpecialCode));
                end;
              mrCancel:
                begin
                end;
           end;
    end
      );
 
        if IsSpecialCodeValid(ModKey, SpecialCode) then
       Result := GetSpecialCodeValue(ModKey,  SpecialCode);
 
{$ENDIF ANDROID}
end; | 
Partager