Delphi DLL ProgressInfo Callbacks

The Chilkat Delphi DLL (non-ActiveX) supports callbacks starting in version 9.5.0.82, to be released in Feb 2020. Pre-release Beta builds are available upon request.

Also see:

1) First define a procedure exactly as shown here. Make sure to use the “cdecl” calling convention.

procedure MyProgressInfo(name: PWideChar; value: PWideChar) cdecl;
begin
  Form1.Memo1.Lines.Add(name + ': ' + value);
end;

2) Set the ProgressInfo callback by calling the appropriate SetProgressInfo function. For the CkSocket object it is CkSocket_SetProgressInfo(sock,MyProgressInfo);

Note: This example shows ProgressInfo callbacks using CkSocket. The same technique applies to any Chilkat class having callbacks.
For example, CkRest_SetProgressInfo.

procedure TForm1.Button1Click(Sender: TObject);
var
  sock: HCkSocket;
  success: Boolean;
begin
    sock := CkSocket_Create();
    CkSocket_SetProgressInfo(sock,MyProgressInfo);

    success := CkSocket_Connect(sock,'google.com',443,True,2000);
    if (success == False) then
      begin
        Memo1.Lines.Add(CkSocket__lastErrorText(sock));
        Exit;
      end;

    Memo1.Lines.Add('Success');
end;