枚举机器上所有 IDispatch 实现对象

发布于 2024-08-11 04:50:02 字数 132 浏览 1 评论 0原文

我想枚举机器上所有 IDispatch 支持对象。目前我需要知道类 id 或 prog id 是什么,但是为了检查我的机器,我想知道是否可以枚举实现 IDispatch 的所有对象。

这可能吗?

任何帮助将不胜感激:)

I'd like to enumerate all IDispatch supporting objects on a machine. At the moment I need to know what the class id or prog id is but, for inspecting my machine, I'd like to know if I can just enumerate all the objects that implement IDispatch.

Is this even possible?

Any help would be much appreciated :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

多彩岁月 2024-08-18 04:50:02

这是一个非常奇怪的要求。摩擦在于“全部”规定。通过 HKCR\Typelib 键和 LoadTypeLib() 进行简单枚举是不够的,COM 服务器不需要发布类型库。实际上,您必须 CoCreateInstance() 组件类和 IDispatch 的 QueryInterface。这不仅慢,而且有风险。

如果您解释为什么您实际上会考虑做这样的事情,您可能会得到更好的答案。在不了解参数的含义或副作用可能是什么的情况下调用 IDispatch::Invoke() 会导致灾难。远离“ReformatDrive”等方法名称。

That's a very odd request. The rub is in the "all" stipulation. Simple enumeration through the HKCR\Typelib key and LoadTypeLib() isn't enough, a COM server is not required to publish a type library. You would actually have to CoCreateInstance() the coclass and QueryInterface for IDispatch. Not only is this slow, it is also risky.

You might get a better answer if you explain why you would actually contemplate doing something like this. Calling IDispatch::Invoke() without having some kind of idea what the arguments mean or what the side-effects might be is a recipe for disaster. Stay away from method names like "ReformatDrive".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文