从Com Interop程序集查找COM DLL路径

编程入门 行业动态 更新时间:2024-10-22 21:43:36
本文介绍了从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路径

本文发布于:2023-11-13 14:31:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584582.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路径   程序   Interop   DLL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!