Board index » cppbuilder » Registering COM servers / creating COM clients

Registering COM servers / creating COM clients

I am trying to create a simple COM client / server test. I have created a
VCL application called "COMServer" which contains a COM object. The COM
object has an interface IMyInterface which contains test methods Method1 &
Method2. These do nothing other than execute a ShowMessage("Method<x>
executed") method.

I have created a "COMClient" application which is meant to call the methods
on the IMyInterface in the "COMServer".

The problems are:

(1) The Register ActiveX component item on the Run menu appears to be greyed
out
(2) If I use the tregsvr command line utility, am I meant to be registering
the Type Library, the COM Server, the interface or what?
(3) How do I create a COM client? The Borland documentation seems to be
lacking here. In the Midas tab there is a TDCOMConnection component which
appears to provide client connection capabilities (both local and remote).
There are properties for ServerName and ServerGUID - but the ServerName
drop-down is empty despite me importing the Type Library for my server, and
the ServerGUID field tells me that the GUID that I got from the "tregsvr"
registration is invalid.

I would appreciate any help or suggestions of __comprehensive__
documentation. Borland - please include examples with __all__ non-trivial
code concepts. CORBA is easy in comparison to all this.

Thanks.

Alan

 

Re:Registering COM servers / creating COM clients


In article <7pn9ms$bh...@forums.borland.com>,

Quote
Alan Magrath <Alan.Magr...@btinternet.com> wrote:
>(1) The Register ActiveX component item on the Run menu appears to be greyed
>out

It will be greyed out if you have a 'local server' (an .exe server),
and active if you have a DLL server. You need to use the commandline
utility.

Quote
>(2) If I use the tregsvr command line utility, am I meant to be registering
>the Type Library, the COM Server, the interface or what?

Yes. Ultmately you register the interface --- but you can do that
by registering the type library --- but the type library is bound into
the .exe, so you can register that, too.

(IOW, any/all of the above will work).

Quote
>(3) How do I create a COM client? The Borland documentation seems to be
>lacking here. In the Midas tab there is a TDCOMConnection component which

Import the type library using Project|Import Type Library.
This will generate some files with c++ wrapper classes like:

TCOMxxxx where xxxx is the interface name.

Then you can include those files in a project and use the
wrapper classes defindei n them to communicate with the server.

--
Caminante, son tus huellas el camino, y nada mas;
caminante, no hay camino, se hace camino al andar ...
Caminante, no hay camino, sino estelas en el mar.

Other Threads