Question

i have a Delphi7.

I use this article: http://www.delphidabbler.com/articles?article=22&part=2 / Step 2

Now, i created a problem with LoadTypeLib (undefined):

type
  TMyClass = class(TAutoIntfObject, IMyIntf, IDispatch)
    constructor Create();
  protected
    procedure helloWorld(); safecall;
  end;

implementation

constructor TMyClass.Create();
var
  TypeLib: ITypeLib;
  s: WideString;
begin
  s := ParamStr(0);
  OleCheck(LoadTypeLib(PWideChar(s), TypeLib)); // ERR:LoadTypeLib is undefined.
  inherited Create(TypeLib, IMyCallback); 
end;

Any suggestions?

Était-ce utile?

La solution

In Delphi 7, the LoadTypeLib function is declared in the ActiveX unit. You must include that unit in your uses clause.

You can find this stuff out for yourself the exact same way that I did it – by searching the source code. Use the Find in Files feature, search for the name of the symbol that is not declared, and search under the Source directory of your Delphi installation.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top