Board index » delphi » Problem registering automation server

Problem registering automation server

Hello,

does anybody know if it is absolutely necessary
for an out-of-process server to base such an
application on TApplication? (I use Delphi 4 Prof.)

I created a very simple application just containing
the lines

program SimpleCOM;
uses windows;
begin
end.

(The reason why I tried this simple application is that
I need an out-of-process-server but no graphic
interface. So I thought this could be a solution to
get rid of unnecessary overhead.)

There is no problem to generate all files using
File/New/ActiveX/Automation Object and so on.

But if the EXE file is run, it doesn't register
itself. Any suggestions?

Regards,
U. Schoth

 

Re:Problem registering automation server


This may not be a great response, but it would seem like you have to add
the code to register your application yourself. And then call the
appropriate methods to do so.

srdan...@hotmail.com

Quote
Ulrik Schoth wrote:
> Hello,

> does anybody know if it is absolutely necessary
> for an out-of-process server to base such an
> application on TApplication? (I use Delphi 4 Prof.)

> I created a very simple application just containing
> the lines

> program SimpleCOM;
> uses windows;
> begin
> end.

> (The reason why I tried this simple application is that
> I need an out-of-process-server but no graphic
> interface. So I thought this could be a solution to
> get rid of unnecessary overhead.)

> There is no problem to generate all files using
> File/New/ActiveX/Automation Object and so on.

> But if the EXE file is run, it doesn't register
> itself. Any suggestions?

> Regards,
> U. Schoth

Re:Problem registering automation server


This will not work for you. The problem is that you do not have a
message loop. Any Windows program runs based of a message loop, and a
message loop is implemented when you call Application.Run. Now, if there

has to be a message loop, there also requires to be messages to operate
the message loop. This can be established only if you have a Window
created. However, you can easily hide the window by making it invisible
by calling "Application.ShowMainWindow:= False".

Typically your code should resemble the following:-
program SimpleCOM;
uses ComServ, Forms, Unit1, windows, youcomobj;
begin
   Application.Initialize;
   Application.ShowMainForm:= False;
   Application.CreateForm(TForm1, Form1);
   Application.Run;
end.

Also remember that you can register a COM object and not the EXE itself.

That is, you cannot have an EXE without a COM object and expect it to
register itself. Hence, I assume the unit yourcomObj.pas contains the
implementation of your COM object.
You can also go ahead and explicitly register a COM Exe on the command
line by using the "regserver" switch. That is you  can run it as
c:\SimpleCOM.exe /regserver.

Hope this helps,

Arjuna Chala

Re:Problem registering automation server


The application doesn't register with COM because that occurs in the
Application.Initialize procedure in the project.

As you don't do it, you will have to do it by hand.

It would be far easier to use TApplication and modify it so you get it to
look as you want it.  You can have a main form that isn't visible, and it is
easy to set it up so it doesn't appear in the taskbar, etc.

Ed

Quote
Ulrik Schoth wrote in message <7m4kld$jc...@forums.borland.com>...
>Hello,

>does anybody know if it is absolutely necessary
>for an out-of-process server to base such an
>application on TApplication? (I use Delphi 4 Prof.)

>I created a very simple application just containing
>the lines

>program SimpleCOM;
>uses windows;
>begin
>end.

>(The reason why I tried this simple application is that
>I need an out-of-process-server but no graphic
>interface. So I thought this could be a solution to
>get rid of unnecessary overhead.)

>There is no problem to generate all files using
>File/New/ActiveX/Automation Object and so on.

>But if the EXE file is run, it doesn't register
>itself. Any suggestions?

>Regards,
>U. Schoth

Other Threads