Board index » delphi » Using COM objects created with VB6 in Delphi 6

Using COM objects created with VB6 in Delphi 6

Subject says it all, really :-)  We have software developed in VB6, a fair
amount of which has been implemented as COM objects shared between VB apps.
We need to use some of these in a Delphi app too, but the Delphi developers
says that VB does create "proper" COM objects, hence they can't use the DLLs
output by VB. Solution so far has been for me to write VC++ ATL COM wrapper
objects: the C++ source uses the #import directive to import the
type-library information from the VB DLL and I then "roll my own" IDL and
create an implementation of this interface in a C++ class. Delphi _can_
create instances of these VC++ COM objects and I give the latter methods
which the Delphi app calls and which internally create an instance of the
underlying VB COM object and simply call the corresponding method of it,
passing the calling parameters straight through. Ditto for return values.
OK, fine, so this works but seems clumsy to me. Plus it starts to get
complicated if the calling parameters of the VB object's methods need to be
anything other than fundmental data types. I'm "piggy in the middle" here:
the vast majority of the VB code was not written by me, none of the Delphi
was written by me (and my comemercial Delphi experience is some years out of
date) I just get lumbered with the task of doing the VC++ bit. Any light
that anyone can shed on this would be highly appreciated.

TIA

SteveM

 

Re:Using COM objects created with VB6 in Delphi 6


Im Artikel <ae4hio$1h...@thorium.cix.co.uk>, "Stephen Malbon"
<smal...@hotmail.com> schreibt:

Quote
>We need to use some of these in a Delphi app too, but the Delphi developers
>says that VB does create "proper" COM objects, hence they can't use the DLLs
>output by VB.

You may find answers in borland.public.delphi.oleautomation.

I vaguely remember that VB objects only implement the dispatch(?) interface,
not both COM interfaces. Perhaps that's the problem?

DoDi

Re:Using COM objects created with VB6 in Delphi 6


Quote
> I vaguely remember that VB objects only implement the dispatch(?)
interface,
> not both COM interfaces. Perhaps that's the problem?

Yes it's true that VB objects only implement IDispatch. Actually I'd been
trawling the web and I looked to me like there should be _no_ problem. So I
got Delphi 6 installed on my PC, looked up in the online help how to get
external COM objects imported and tried it with a dummy VB COM object. It
worked first time. Never mind, it's kept me busy these past few months
writing VC++ wrappers for various VB COM objects :-)

SteveM

Other Threads