将清单文件移动到dll? [英] Move manifest file to dll?

查看:191
本文介绍了将清单文件移动到dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用第三方组件,作为COM组件分发,或者可以使用.manifest文件进行引用。无论哪种方式,它使用CoCreateInstance()加载。第三方组件所需的文件位于子文件夹中。组件开发人员告诉我在可执行文件的Visual Studio 2010设置(在清单部分)中包含一个.manifest文件,并且加载组件没有问题。

I'm using a third party component in my application that is distributed either as a COM component, or can be referenced using a .manifest file. Either way it is loaded using CoCreateInstance(). The files needed for the third party component reside in a subfolder. The component developer told me to include a .manifest file in the Visual Studio 2010 settings (in the "Manifest" section) of the executable, and loading the component works without problems.

现在我只使用来自DLL的第三方组件,以封装从第三方组件使用的功能。我动态加载DLL,使用LoadLibrary()。使用该组件仍然可以使用从具有清单文件引用的EXE加载的DLL中的组件。

Now I'm using the third party component from a DLL only, to encapsulate the features used from the third party component. I'm loading the DLL dynamically, using LoadLibrary(). Using the component still works, I can use the component from within the DLL that is loaded by the EXE that has the manifest file referenced.

要进一步将EXE与第三个组件,我想将清单移动到DLL,也是唯一的地方,组件被使用。这样每个新的EXE我想写可以使用DLL和间接使用的功能。现在,我必须添加mainfest到每个新的EXE,但我不想这样做。

To further separate the EXE from the third pary component, I'd like to move the manifest to the DLL, too, where is the only place the component is used. In this way every new EXE I'd like to write can use the DLL and indirectly use the features. For now, I have to add the mainfest to every new EXE, but I don't want to do that.

有一种方法来移动EXE到DLL?

Is there a way to move the manifest used by the EXE to a DLL?

推荐答案

您可以将清单放在DLL中,但它可能不会自动激活。您可能需要使用激活上下文API手动执行此操作。我认为很多取决于清单被用于什么。

You can put the manifest in the DLL, but it may not be activated automatically. You may need to do that manually using the activation context API. I think a lot depends on what the manifest is being used for. I suspect you are trying to use registration free COM, but that's only a guess.

无论如何,这些链接可能对你有用:

Anyway, these links may well be useful to you:

  • RT_MANIFEST resource, and ISOLATION_AWARE_ENABLED (Junfeng Zhang)
  • Isolating Components (MSDN)

这篇关于将清单文件移动到dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆