在哪里需要切换激活上下文? [英] Where do I need to switch the Activation Context?
问题描述
我面对的问题本质上是这里描述,即:/ p>
- 我有一个DLL正在使用第三方进程中的COM组件dll。
- 我想嵌入和使用manfest到这个DLL(不是主EXE),以便我可以使用第三方 c>
- 第三方COM组件没有任何其他(COM)依赖项,不依赖或需要隔离。
我看到简单地嵌入清单到我的DLL不工作,正如在链接问题中所描述的,我将需要切换激活上下文。
不理解是在哪里,当我需要切换激活上下文:我只需要包装我的调用 CoCreateInstance
在像 CActCtxActivator ScopedContext
(*),或者我需要将所有调用包装到第三方组件中吗? (其中,据我所知是 ISOLATION_AWARE_ENABLED
应该可以帮助。)
所以,当使用免注册COM时,你需要在哪里切换激活上下文?
(*):或 AFX_MANAGE_STATE(AfxGetStaticModuleState());
或任何。
将您的调用包装到 CoCreateInstance
,因为第三方组件没有其他依赖项。
如果有其他依赖关系,则需要将调用包装到第三方组件中。
The problem I'm facing is essentially described here, that is:
- I have a DLL that is using a 3rd party in-process COM component dll.
- I want to use registration free COM with that in-process component.
- I want to embed and use a manfest into this DLL (not into the main EXE) so that I can use the 3rd party component in a reg free way.
- The Interface I use from the component is activated through a call to
CoCreateInstance
. - The 3rd party COM component hasn't got any further (COM) dependencies and doesn't rely on or need isolation.
I see that simply embedding a manifest into my DLL doesn't work, as as is described in the linked question, I will need to switch the Activation Context manually.
What I do not understand is where and when I need to switch the Activation Context: Do I only need to wrap my call to CoCreateInstance
in something like CActCtxActivator ScopedContext
(*), or would I need to wrap all calls into the 3rd party component? (Which, as far as I understand is what ISOLATION_AWARE_ENABLED
is supposed to help with.)
So, when using registration free COM, where do you need to switch the Activation Context?
(*) : Or AFX_MANAGE_STATE(AfxGetStaticModuleState());
or whatever.
You only need to wrap your call to CoCreateInstance
, given that the 3rd party component has no other dependencies.
If it had other dependencies, then you would need to wrap the calls into the 3rd party component.
这篇关于在哪里需要切换激活上下文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!