0

I am working on a Delphi application which may be started either - directly, as a desktop application, by running the application (e.g. by clicking the executable in the explorer) or - indirectly, as an out of process server, by creating any of the COM objects implemented in (and registered by) the application

Is there a way to detect if my application has been started as an out of process COM Server or as a desktop application?

RM.
  • 1,863
  • 15
  • 24

1 Answers1

0

When the COM object is registered, you can include command-line parameters for it, such as /automation, and then look for those parameters when the process is started.

HOWEVER, because this is an out-of-process server, there is an issue this will not address. Let's say the server is run as an app first, and then the COM object is created while the app is still running. The COM object will simply come from the existing process, which was not started as a COM process, so the COM command-line parameters will not be present. That may or may not affect what you are looking to do based on the process start type.

Remy Lebeau
  • 454,445
  • 28
  • 366
  • 620