如何通过代码获取Visual Studio中可用的COM对象列表? [英] How to get available COM object list in visual studio by code?

查看:107
本文介绍了如何通过代码获取Visual Studio中可用的COM对象列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在c#项目中,将com对象作为引用添加时,当我们将程序部署到客户端计算机时可能会导致一些意想不到的问题,例如com对象未正确注册,版本问题等.
当需要在ac#项目中添加com对象作为引用时,我们单击添加引用..."以打开表单并选择"COM"标签页,然后将出现可用的com对象列表.

有人可以告诉我如何通过代码获取此com对象列表吗?

In c# project ,adding com object as reference may cause some unexpected problems when we deploy our program to the client''s machine,such as the com object not registered properly,version problem etc.
When we need to add a com object as reference in a c# project ,we click the ''add reference...'' to open the form and choose the ''COM'' tab page, then available com object list will appear .

Could anyone tell me how to get this com object list by code?

推荐答案



您可以根据要查找的内容在类"Win32_ClassicCOMClass"和"Win32_DCOMApplication"(均在cimv2命名空间中)中尝试对应用程序进行WMI查询.

最好的问候
Hi,

you could try a WMI query for the application in the classes "Win32_ClassicCOMClass" and "Win32_DCOMApplication" (both in the cimv2 namespace) depending on what you are looking for.

Best regards


这篇关于如何通过代码获取Visual Studio中可用的COM对象列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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