Keyboard Support

Contact and Search

Keyman.com Homepage

Header bottom

Keyman.com

Other versions
Version 13.0 (home page, current version)Version 12.0 (home page)Version 11.0 (home page)Version 10.0 (home page)Version 9.0 (home page)Version 8.0 (home page)Version 7.0Version 6.0 (home page)Version 5.0 (home page)Version 4.0 (home page)

Index

On this page

IKeymanProduct::Activate

Attempt to activate the product using the activation blob provided. If activation fails, a reason will be given in an exception.

Declaration
Sub Activate(ActivationResponseBlob As String)
Parameters
NoNameTypeDescription
1ActivationResponseBlobStringA text string as returned from the Tavultesoft Activation Server
Example Code
            

function ActivateProduct(const licno: WideString): Boolean;
var
  s: string;
  arb: WideString;
begin
  Result := False;

  { Validate the licence number }

  try
    FActiveProduct.GetActivationRequestCode(licno, arb);
  except
    on E:EOleException do
    begin
      WideShowMessage(MsgFromIdFormat(SKActivation_InvalidLicenceNumber, [E.Message]));
      Exit;
    end;
  end;

  { Connect to tavultesoft.com and get the response blob }

  try
    with THTTPUploader.Create(nil) do
    try
      Fields.Add('LicenceNumber', licno);
      Fields.Add('ActivationRequestBlob', arb);
      Proxy.Server := GetProxySettings.Server;
      Proxy.Port := GetProxySettings.Port;

      Request.Agent := 'Tavultesoft Keyman/'+GetVersionString;
      Request.Protocol := Upload_Protocol;
      Request.HostName := Upload_Server;
      Request.UrlPath := UploadPath_Activation; // '/prog/70/activation.php';
      Upload;
      s := Trim(Response.MessageBodyAsString);
    finally
      Free;
    end;
  except
    on E:Exception do
    begin
      WideShowMessage(MsgFromIdFormat(SKActivation_ErrorConnectingToTavultesoft, [E.Message]));
      Exit;
    end;
  end;

  { Check that no trappable errors occurred }

  if Copy(s, 1, 7) = '<error>' then
  begin
    Delete(s,1,7);
    if Pos('</error>', s) > 0 then Delete(s, Pos('</error>', s), Length(s));
    WideShowMessage(MsgFromIdFormat(SKActivation_ErrorActivating, [s]));
    Exit;
  end;

  { Pass the response blob to kmcomapi for validation and product activation }

  try
    FActiveProduct.Activate(s);
  except
    on E:EOleException do
    begin
      WideShowMessage(MsgFromIdFormat(SKActivation_ErrorActivating, [E.Message]));
      Exit;
    end;
  end;

  WideShowMessage(MsgFromId(SKActivation_Success));
  Result := True;
end;