Board index » delphi » Registering OleAutomation Server

Registering OleAutomation Server

Please Help
I have written a client server application similar to the AutoServer demo
that comes with delphi. It works great locally but to get it to work
remotely via DCom I first have to run my server application on the client
machine to register it before I can connect.

My question is how can I register my server on the client machine without
having to install the (rather large) server application and deleting it
every time.

I read somewhere that I can do it by running Delphi\bin\tregsrvr with the
tlib file but is there anyway to do it inside my client app in code

Thanks in Advance

 

Re:Registering OleAutomation Server


Ken,

Sadly the object must reside in the remote machine, and be registered so
that DCOM can locate it in the RegDB.  Typically you use the tregsrvr as you
realise.  Registering the server is merely a process of setting up entries
in the RegDB.

Nick.

Quote
Ken O'Halloran <ke...@onwe.co.za> wrote in message

news:7s6733$bnn12@forums.borland.com...
Quote
> Please Help
> I have written a client server application similar to the AutoServer demo
> that comes with delphi. It works great locally but to get it to work
> remotely via DCom I first have to run my server application on the client
> machine to register it before I can connect.

> My question is how can I register my server on the client machine without
> having to install the (rather large) server application and deleting it
> every time.

> I read somewhere that I can do it by running Delphi\bin\tregsrvr with the
> tlib file but is there anyway to do it inside my client app in code

> Thanks in Advance

Re:Registering OleAutomation Server


Ken

All you need to do is register the server's type (*.tlb) library in the
client machine.
If you look in your project's working directory you will find the file there.

On the client, use API Windows call LoadTypeLibEx (see below) to register the
binary *.tlb file which you'll need to ship it with your client. When you run
the server on the client's machine, you are in fact registering the type
library into the registry. That's why you can afterwards remove the server
executable and the client starts working properly!

procedure registermytypelibrary;
var
    lTypeLibrary : ITypeLibrary;
begin
    LoadTypeLibraryEx('TheTypelibrary.tlb',REGKING_REGISTER,lTypeLibrary);
end;

A good article on deploying applications using DCom can be found in the
Delphi magazine: "DCOM deployment secrets", issue 45, pag 26-31.

Paulo

Quote
Ken O'Halloran wrote:
> Please Help
> I have written a client server application similar to the AutoServer demo
> that comes with delphi. It works great locally but to get it to work
> remotely via DCom I first have to run my server application on the client
> machine to register it before I can connect.

> My question is how can I register my server on the client machine without
> having to install the (rather large) server application and deleting it
> every time.

> I read somewhere that I can do it by running Delphi\bin\tregsrvr with the
> tlib file but is there anyway to do it inside my client app in code

> Thanks in Advance

Re:Registering OleAutomation Server


My tutorial on "Implementing a DCOM Application" might help. There's a
fairly huge section towards the end that deals with DCOM configuration.

Go http://www.castle.net/~bly/com and into the Tutorials section.

BTW, TRegSvr comes with the source code (somewhere in the Delphi Samples
folders) if you want to know which APIs to use to register a typelib.

have fun
--
Binh Ly
Visit my COM Notes at http://www.castle.net/~bly/com

Quote
Ken O'Halloran <ke...@onwe.co.za> wrote in message

news:7s6733$bnn12@forums.borland.com...
Quote
> Please Help
> I have written a client server application similar to the AutoServer demo
> that comes with delphi. It works great locally but to get it to work
> remotely via DCom I first have to run my server application on the client
> machine to register it before I can connect.

> My question is how can I register my server on the client machine without
> having to install the (rather large) server application and deleting it
> every time.

> I read somewhere that I can do it by running Delphi\bin\tregsrvr with the
> tlib file but is there anyway to do it inside my client app in code

> Thanks in Advance

Re:Registering OleAutomation Server


Sound like a good suggestion Paulo, but I cant find the LoadTypeLibEx
declared anywhere in delphi nor in win32sdk help. Where do I find it? I find
a function called LoadTypeLib but it doesn't take the parameter
REGKING_REGISTER which I assume is to tell it to register.

I actually have the latest Delphi Magazine CD-ROM  on order from the UK but
cant wait that long. (It has to make it here through the jungle by elephant,
passed all the bandits etc :-) )

PS I have Delphi 4

Quote
Paulo Pinheiro <p...@techprt.co.uk> wrote in message

news:37E77729.610B7A60@techprt.co.uk...
Quote
> Ken

> All you need to do is register the server's type (*.tlb) library in the
> client machine.
> If you look in your project's working directory you will find the file
there.

> On the client, use API Windows call LoadTypeLibEx (see below) to register
the
> binary *.tlb file which you'll need to ship it with your client. When you
run
> the server on the client's machine, you are in fact registering the type
> library into the registry. That's why you can afterwards remove the server
> executable and the client starts working properly!

> procedure registermytypelibrary;
> var
>     lTypeLibrary : ITypeLibrary;
> begin
>     LoadTypeLibraryEx('TheTypelibrary.tlb',REGKING_REGISTER,lTypeLibrary);
> end;

> A good article on deploying applications using DCom can be found in the
> Delphi magazine: "DCOM deployment secrets", issue 45, pag 26-31.

> Paulo

> Ken O'Halloran wrote:

> > Please Help
> > I have written a client server application similar to the AutoServer
demo
> > that comes with delphi. It works great locally but to get it to work
> > remotely via DCom I first have to run my server application on the
client
> > machine to register it before I can connect.

> > My question is how can I register my server on the client machine
without
> > having to install the (rather large) server application and deleting it
> > every time.

> > I read somewhere that I can do it by running Delphi\bin\tregsrvr with
the
> > tlib file but is there anyway to do it inside my client app in code

> > Thanks in Advance

Re:Registering OleAutomation Server


Ken,

LoadTypeLibEx is declared in ActiveX.pas in Delphi 4.

HTH

Nick.

Quote
Ken O'Halloran <ke...@onwe.co.za> wrote in message

news:7s911u$7bp5@forums.borland.com...
Quote
> Sound like a good suggestion Paulo, but I cant find the LoadTypeLibEx
> declared anywhere in delphi nor in win32sdk help. Where do I find it? I
find
> a function called LoadTypeLib but it doesn't take the parameter
> REGKING_REGISTER which I assume is to tell it to register.

> I actually have the latest Delphi Magazine CD-ROM  on order from the UK
but
> cant wait that long. (It has to make it here through the jungle by
elephant,
> passed all the bandits etc :-) )

> PS I have Delphi 4

> Paulo Pinheiro <p...@techprt.co.uk> wrote in message
> news:37E77729.610B7A60@techprt.co.uk...
> > Ken

> > All you need to do is register the server's type (*.tlb) library in the
> > client machine.
> > If you look in your project's working directory you will find the file
> there.

> > On the client, use API Windows call LoadTypeLibEx (see below) to
register
> the
> > binary *.tlb file which you'll need to ship it with your client. When
you
> run
> > the server on the client's machine, you are in fact registering the type
> > library into the registry. That's why you can afterwards remove the
server
> > executable and the client starts working properly!

> > procedure registermytypelibrary;
> > var
> >     lTypeLibrary : ITypeLibrary;
> > begin

LoadTypeLibraryEx('TheTypelibrary.tlb',REGKING_REGISTER,lTypeLibrary);

- Show quoted text -

Quote
> > end;

> > A good article on deploying applications using DCom can be found in the
> > Delphi magazine: "DCOM deployment secrets", issue 45, pag 26-31.

> > Paulo

> > Ken O'Halloran wrote:

> > > Please Help
> > > I have written a client server application similar to the AutoServer
> demo
> > > that comes with delphi. It works great locally but to get it to work
> > > remotely via DCom I first have to run my server application on the
> client
> > > machine to register it before I can connect.

> > > My question is how can I register my server on the client machine
> without
> > > having to install the (rather large) server application and deleting
it
> > > every time.

> > > I read somewhere that I can do it by running Delphi\bin\tregsrvr with
> the
> > > tlib file but is there anyway to do it inside my client app in code

> > > Thanks in Advance

Other Threads