"Roland Pisano" <rpisano@wanadoo.fr> wrote:
 
>I have created an OCX with vb5. It works fine in other programs I'm making.
>I can insert it in a new form and I can all use its
>properties/methods/events.
>A friend of mine is using Delphi (I don't know wich version but it's one of
>the last). I've sent him my control. He has registered it and tried to
>import it in one of his project. But it didn't work. Delphi is sending him a
>message of this kind : vtable entry is missing (it's a translation, as the
>original error message is in french).
>So, I think that I didn't do what was necessary for Delphi. I've read the
>the vtable is the combination of IUnknown and IDispatch interfaces. But what
>is this ? And how to create it ?
>It seems to be related with MkTypLib utility, I found it on my VB CD but I
>can't figure how it works.
 
Roland,
I had similar problems with a VB5 developed OCX and Delphi. I found the solution in a Delphi newsgroup (accessible from the Borland web site) about a month or two ago. Here is a copy of the message - hope it helps!
 
Shailesh Shah <sshah@anstec-tech.com> wrote in message
<6vijjo$r2313@forums.borland.com>...
> I found the work-around for this problem. Its not elegant and it is little
> tedious but hey, it works like a charm !!
> Here's the scoop:
> By default, when Delphi generatd TypeLib from the OCX (XXX_TLB unit), it
> uses the v-table interface. Something funky in VB or delphi causes these
> GPFs. so I tweaked the code generated code to use disp interface instead of
> v-table interface.
> You need to make 4-5 small changes in TLB module. The following is taken
> from my sample app. Make the appropriate change for your application:
> (the code in the comment was generated by delphi which i replaced)
>
>    ...
>    FIntf: _UserControl1Disp; {_UserControl1;}
>    function  GetControlInterface: _UserControl1Disp; {_UserControl1;}
>    ...
>    property  ControlInterface: _UserControl1Disp {_UserControl1} read
> GetControlInterface;
>    ....
>
>    procedure TUserControl1.CreateControl;
>
>          procedure DoCreate;
>          begin
>            FIntf := IUnknown(OleObject) as _UserControl1Disp;
> {_UserControl1;}
>          end;
>    begin
>          if FIntf = nil then DoCreate;
>    end;
>
>    function TUserControl1.GetControlInterface: _UserControl1Disp;
> {_UserControl1;}
>    begin
>          CreateControl;
>          Result := FIntf;
>    end;
>
>
> Sounds simple, huh ? the catch is that everytime you re-import the library,
> these changes will be lost. (read the header of TLB unit for details). So
> save these changes somewhere else and re-apply them everytime you re-import
> the type library.
>
>
> I also found the other problem which is not related to this one but you are
> likely to run into that if u use OUT parameters.
> suppose you have a method in VB with out paramter which looks like:
>        function GetText () as string
> When Delphi import type library, it creates a prototype that looks like
>        function GetText(out Param1 : WideString) :  WideString;
> Now, I am not a pascal expert, but anyone can say that this function will
> except one parameter and return 1 parameter. The question is which one will
> have the actual return value ????? When I use the following syntax:
>        GetText( wstrRetVal); {wstrRetVal is of type WideString}
> wstrRetVal was blank !!!!!
>
> If I use    wstrRetVal := GetText();
> compiler went crazy !!
> So i used
>                wstrRetVal1 := GetText(wstrRetVal2);
>
> and guess what ???  wstrRetVal1 had the return value but wstrRetVal2 didnt
> !!!!!!!!
>
>
> Shailesh Shah
>
>
> Rukesh Patel wrote in message <6vhq8i$pvv7@forums.borland.com>...
> >Hi,
> >I have developed and ActiveX in VB. This ActiveX runs fine on Delphi
> except,
> >when any method is called, it will give any one of the  following errors:
> >
> >1. Invalid Property
> >2. OLE Error 800A01A9  - (Not documented any where).
> >3. GPF
> >
> >There are others having the same problem in this newsgroup, search for
> >message
> >'Error 800A01A9 calling OCX method !'
> >
> >I wonder, whether this is a bug in Delphi or something that VB doesn't set
> >right. Same ActiveX written in VC++ works fine.
> >
> >Can someone please shed some light on this one?
> >
> >Regards,
> >Rukesh