Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write an EXE which is also a COM Server in Delphi

I have a Delphi (2007) application which is just a standard exe, and I would like to add a COM interface to it. I already have a COM dll which exports several COM objects and this is working perfectly. However when I attempted to insert the COM logic from the dll (ie the "exports" and "{$R *.TLB}" and the relevant uses) into the EXE's dpr file it all compiles perfectly but refuses to register when I call regsvr32 myname.exe

I also tried creating an completely new VCLForms application and adding a AutomationObject to it via the IDE wizards but Delphi does not seem to want me to do that as no activex components are available.

Is it even possible to do what I attempting? If so, does anyone have any idea on what might be going wrong?

Thanks

like image 701
Steve Avatar asked Dec 07 '10 11:12

Steve


2 Answers

I'm not sure regsvr32 works, you need to run the app.exe /regserver or app.exe /unregserver.

like image 67
Richard Chamberlain Avatar answered Oct 14 '22 20:10

Richard Chamberlain


Is your exe exporting DllRegisterServer and DllUnregisterServer?

like image 36
Remko Avatar answered Oct 14 '22 21:10

Remko