Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Out of process COM server execution

Tags:

com

delphi

I've turned an ancient, but still useful, Delphi 5 application into an out of process COM server. I vaguely recall that there's a way to tell if it's started directly by a user or as the server. I know I've done it before, but I can't remember/find how to do it. A command line switch, maybe?

like image 592
Spike Avatar asked Sep 12 '12 23:09

Spike


2 Answers

I do not know whether this was available in Delphi 5, but in Delphi 2010 you can query the global ComServer object for the start mode:

if ComServer.StartMode = smAutomation then
  ShowMessage('started as automation server')
else if ComServer.StartMode = smStandalone then
  ShowMessage('started manually');
like image 176
Lars Frische Avatar answered Sep 30 '22 09:09

Lars Frische


It seems that the exe is started with the switch "-Embedding" when started as a COM server.

like image 27
Spike Avatar answered Sep 30 '22 10:09

Spike