从Com Interop程序集查找COM DLL路径 [英] Find COM DLL path from Com Interop Assembly

查看:59
本文介绍了从Com Interop程序集查找COM DLL路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试围绕旧版COM对象编写包装器,并将该包装器安装到GAC中。目标是自动设置组件所需的特定配置信息,并为我的所有应用程序使用通用的强类型接口。

I am trying to write a wrapper around a legacy COM object and install the wrapper into the GAC. The goal would be to automate the setup of specific configuration information the component requires, and make a common strongly typed interface for all of my applications to use.

到目前为止,我的解决方案是将XML配置文件与原始COM DLL放在同一目录中,并将配置加载到类构造函数中。不幸的是,我无法找到已注册的COM dll的位置...

My solution thus far is to keep an XML configuration file in the same directory as the original COM DLL, and load the configuration in the class constructor. Unfortunately, I have been unable to find the location of the registered COM dll...

如何获取COM对象引用的COM dll的完整文件路径。互操作dll?

How do I get the full file path of the COM dll referenced by a COM object interop dll?

推荐答案

一旦从相应的COM服务器创建了对象,则必须已加载其DLL。假定底层COM服务器是在 mycomserver.dll中实现的,则可以使用P / Invoke并调用GetModuleHandle( mycomserver.dll)-这将为您提供DLL的路径。

Once you've created an object from the respective COM server, its DLL must have been loaded. Assuming that the underlying COM server is implemented in "mycomserver.dll", you could use P/Invoke and call GetModuleHandle( "mycomserver.dll" ) -- that gives you the path of the DLL.

这篇关于从Com Interop程序集查找COM DLL路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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