Hello,
i was importing a Wrapper Class DLL for a .NET assembly. i used the TLB which was generated when registering with regasm. Then Used the Import type library tool on the generated tlb File. Everything worked but when i tried to use the Type Library i got this Error: ACompaniesWrapper_1_0_tlb.pas(38,18) Error: default dispinterface ancestor IDispatch not found. why is no IDispatch interface created ? is there a Problem with the wrapper ? do i need to change/define an interface in the wrapper so that the tool can import the IDispatch too ? can i write the IDispatch myself ?
Here is the Generated Unit:
Unit ACompaniesWrapper_1_0_TLB;
{$mode delphi}{$H+}
interface
Uses
Windows,ActiveX,Classes,Variants;
Const
ACompaniesWrapperMajorVersion = 1;
ACompaniesWrapperMinorVersion = 0;
ACompaniesWrapperLCID = 0;
LIBID_ACompaniesWrapper : TGUID = '{E1F9AE4A-596C-4FBE-A6D0-925BD6370C8E}';
IID__ACompaniesWrapper : TGUID = '{8D53AB40-F6D8-4CF3-A129-F9938D80AB8A}';
CLASS_ACompaniesWrapper : TGUID = '{191B3B9F-F2B9-43D7-8AD8-7B471E3BB9A2}';
//Enums
//Forward declarations
Type
_ACompaniesWrapper = dispinterface;
//Map CoClass to its default interface
ACompaniesWrapper = _ACompaniesWrapper;
//records, unions, aliases
//interface declarations
// _ACompaniesWrapper :
_ACompaniesWrapper = dispinterface
['{8D53AB40-F6D8-4CF3-A129-F9938D80AB8A}']
// ExecuteCommand :
function SomeFunction(var sRequestData:WideString):WideString;dispid 1;
// StartUp :
function Init(sPathName:WideString):WideString;dispid 2;
end;
//CoClasses
CoACompaniesWrapper = Class
Public
Class Function Create: _ACompaniesWrapper;
Class Function CreateRemote(const MachineName: string): _ACompaniesWrapper;
end;
implementation
uses comobj;
Class Function CoACompaniesWrapper.Create: _ACompaniesWrapper;
begin
Result := CreateComObject(CLASS_ACompaniesWrapper) as _ACompaniesWrapper;
end;
Class Function CoACompaniesWrapper.CreateRemote(const MachineName: string): _ACompaniesWrapper;
begin
Result := CreateRemoteComObject(MachineName,CLASS_ACompaniesWrapper) as _ACompaniesWrapper;
end;
the interface is declared like this:
<Guid("8D53AB40-F6D8-4CF3-A129-F9938D80AB8A"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Edit:
needed to change it to this:
<Guid("8D53AB40-F6D8-4CF3-A129-F9938D80AB8A"), InterfaceType(ComInterfaceType.InterfaceIsDual)> _