Import Type Library in Delphi

Component->Install Component
Import a Type Library
Add unit to Project

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, MyTypeLibrary_TLB;

Note the info:

  SomeInterface = interface(IDispatch)
    procedure SomeProcedure(...); safecall;

Button Event:

procedure TForm1.Button1Click(Sender: TObject);
var
  MyInterface: SomeInterface;
begin
  MyInterface.SomeProcedure(...);
end;

For some class, note the info:

  SomeClass = class
    class function Create: SomeInterface;
    class function SomeFunction(...): SomeInterface;
  end;

Button event:

procedure TForm1.Button1Click(Sender: TObject);
var
  MyInterface: SomeInterface;
begin
  MyInterface:= SomeClass.Create;
end;
Advertisements