Board index » cppbuilder » BCB, Ole Automation, COM Interface and In Process Server question

BCB, Ole Automation, COM Interface and In Process Server question

Hello all,

I try to write an (OCX-) DLL with the CPP-Builder. I want to use this DLL
as an OLE InProcess-Server from Delphi.

The problem is, that Delphi reports an error "class not registered" when I
try to
access the com object.

I load the (OCX-)DLL in the Delphi program and call DllRegisterServer. This
function is exported from the (OCX-)DLL. This should register all ole
objects
residing in that DLL. I don't want to register the ole objects globally with
RegServ
(and I need not if I call DllRegisterServer).

I think the main problem is, that my CPP-Builder DLL does'nt create an
interface
for the ole automation object it exports and I don't know how to create one.
Also a Typelib would be usefull (how do I create one for C).

I wrote a similar (OCX-)DLL in Delphi (3) itself, and could call the ole
object
without problems (in the way I described above).

Dirk Seifert

Seif...@Geutebrueck.de

 

Re:BCB, Ole Automation, COM Interface and In Process Server question


Quote
Dirk Seifert wrote in message <6a75lj$l...@forums.borland.com>...
>Hello all,

>I try to write an (OCX-) DLL with the CPP-Builder. I want to use this DLL
>as an OLE InProcess-Server from Delphi.

>The problem is, that Delphi reports an error "class not registered" when I
>try to
>access the com object.

My first question is, how are you trying to access the COM object?  Are you
doing a
Variant::CreateObject or a CreateOleObject?

Quote

>I load the (OCX-)DLL in the Delphi program and call DllRegisterServer. This
>function is exported from the (OCX-)DLL. This should register all ole
>objects
>residing in that DLL. I don't want to register the ole objects globally
with
>RegServ
>(and I need not if I call DllRegisterServer).

Where is it registering them?  According to the docs I've read, the
DllRegisterServer is used
to register the server and it's type library in the system registry.  Why
don't you wan the objects
to be registered globally?  If you really don't want them registered, create
at least one registered
object that can then be used to access the other non registered objects.
Just make sure the
instancing type is set to internal.

Quote

>I think the main problem is, that my CPP-Builder DLL does'nt create an
>interface
>for the ole automation object it exports and I don't know how to create
one.
>Also a Typelib would be usefull (how do I create one for C).

C++ builder does not support interfaces like Delphi 3 does.  In Delphi 3, a
type library
is generate for you and you can specify multiple interfaces that a COM
object supports.  You
can't do this in C++ builder.

Quote

>I wrote a similar (OCX-)DLL in Delphi (3) itself, and could call the ole
>object
>without problems (in the way I described above).

Mike Gaffney

Other Threads