Unit1.pas
---------

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, ShellAPI;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Edit2: TEdit;
    Button2: TButton;
    Label3: TLabel;
    Edit3: TEdit;
    procedure Button2Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
var s1, s2     : String;
    Result     : Integer;
    bOK, bWait : Boolean;
    Info       : TShellExecuteInfo;

begin

    s1 := Edit3.Text;  //  <-- c:\temp\unlock_ald.exe
    s2 := Edit1.Text;  //  <-- c:\temp\form.pdf 1

    bWait := True;
    FillChar(Info, SizeOf(Info), Chr(0));
    Info.cbSize := SizeOf(Info);
    Info.fMask := SEE_MASK_NOCLOSEPROCESS;
    Info.lpVerb := PChar('open');
    Info.lpFile := PChar(s1);        //   <-- with the unlock_ald.exe
    Info.lpParameters := PChar(s2);  //   <-- with the pdf-file and option
    Info.lpDirectory := PChar(ExtractFilePath(s1));
    Info.nShow := SW_SHOWNORMAL;
    bOK := Boolean(ShellExecuteEx(@Info));
    if bOK then
    begin
      if bWait then
        begin
          while
            WaitForSingleObject(Info.hProcess, 100) = WAIT_TIMEOUT
            do Application.ProcessMessages;
            bOK := GetExitCodeProcess(Info.hProcess, DWORD(Result));
        end
       else
        Result := 0;
    end;
    if not bOK then Result := -1;
    Edit2.Text := IntToStr(Result);

end;

end.
