Re: Want COM to use a running DLL, not load it again
And beware that your EXE is a COM server now - it shouldn't
exit until all COM objects are released by their clients. That's
the main caveat here as the DLL doesn't tell its host executable
when it's safe to exit. The EXE can poll DllCanUnloadNow
for that purpose.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://vcfaq.mvps.org
=====================================
"Igor Tandetnik" <itandetnik@mvps.org> wrote in message
news:e8YSE6EqHHA.208@TK2MSFTNGP05.phx.gbl...
Scott McPhillips [MVP] <org-dot-mvps-at-scottmcp> wrote:
Thanks (again!) Igor. The EXE is generic, and loads specifed DLLs
explicitly for different applications. I see that
CoRegisterClassObject does not pass the hInstance, so it seems like I
can't call this from a DLL running within the EXE process. Sound
right?
What does taking an HINSTANCE have to do with a DLL being able or unable
to call a function? Which, I guess, is a long way of saying that yes, you
can happily call CoRegisterClassObject from a DLL running within an EXE
process. This effectively turns this EXE into an out-of-proc server.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925