Board index » delphi » Getting rid of message on shutdown

Getting rid of message on shutdown

I launch an app via OLE automation and if I then try to close the app I get
a COM Server warning. Is there a way to get round this? Also I don't want
the app to shut when I close my calling app. My thought was I'd have to
start the OLE Server by using ShellExecute (I presume I can work out the EXE
name by fiddling in the registry) and then when I create my OLE Server
instance it'll go back to the same server. I was just wondering if there is
a more elegant method to achieve this
 

Re:Getting rid of message on shutdown


Chris,

I dont think that will work.  Delphi inserts a TerminateProc into the list of
termination procedures to be invoked when the application shutsdown - one of
which is related to the COM session.  This TerminateProc is private to the
Delphi COM runtime, and inside the proc. the count for the number of users
connected to the server is checked - > 0 results in the aforementioned
messagebox.  Without a hack, I am not sure you would be able to safely get this
removed from memory without a struggle.

--
Nicholas Robinson
Software Development Consultant
--- http://www.nrobin.demon.co.uk/ ---
--- http://www.deja.com/~comdelphi/ ---

Quote
Chris Bell <doo...@lineone.net> wrote in message

news:82oc6h$a123@forums.borland.com...
Quote
> I launch an app via OLE automation and if I then try to close the app I get
> a COM Server warning. Is there a way to get round this? Also I don't want
> the app to shut when I close my calling app. My thought was I'd have to
> start the OLE Server by using ShellExecute (I presume I can work out the EXE
> name by fiddling in the registry) and then when I create my OLE Server
> instance it'll go back to the same server. I was just wondering if there is
> a more elegant method to achieve this

Re:Getting rid of message on shutdown


One way you *might* be able to shut down the server first is to setup a
com callback to the client (calling app) to tell it to let go of the
automation object.  The automation object could then ask the form (or
whatever else created it in the client) to destroy it. This is fraught
with danger.

As for keeping the server alive forever, create a dummy automation
object and in the form.create of the server simply create the object.
TComServer's object count will never go below 1.

Sent via Deja.com http://www.deja.com/
Before you buy.

Other Threads