Alex Rivera | Logout

Is registration-free activation possible for EXE (out-of-process) COM servers?

Asked 2010-07-09T09:22:17.207
10

I know that we can use CoLoadLibrary and DllGetClassObject to get the IClassFactory interface and get the COM component interface without registering the DLL.

But what about a COM component in an EXE? Is there a way that I can get a COM component interface from an EXE-type COM server by just providing a different file path?

Edit
Report

1 Answer

2

No, you cannot. You need COM setup marshalling between your program and out-proc COM server. To achieve this you have to call CoInitialize() and then either CoCreateInstance() or CoGetClassObject().

The path you describe with an in-proc server - calling CoLoadLibrary() and then DllGetClassObject() - is in fact a dirty hack - it bypasses normal COM mechanisms and so for example no marshalling will kick in even if it is needed to satisfy threading model requirements (STA/MTA stuff). Such dirty hack is possible because an in-proc server is a regular DLL with several well-known functions exposed. The same is impossible for an out-proc COM server - you need to rely on COM in that case.

answered 2010-07-09T09:47:49.157

Your Answer