如何在纯 C 中使用 IDispatch 来调用 COM 对象 [英] How to use IDispatch in plain C to call a COM object
问题描述
我需要使用 R 工具中包含的 gcc 编译器(R 是 windows 的统计程序)编译我的一些代码,问题是我需要在我的代码中使用 IDispatch 来创建一个访问 COM 的方法对象,而 gcc 编译器不支持我用来执行此操作的大部分代码,这些代码基本上是 C++ 代码.
I need to compile some code of mine using the gcc compiler included in the R tools (R the statistical program for windows), the problem is that I need to use IDispatch in my code to create an access the methods of a COM object, and the gcc compiler doesn't support much of the code that I'm using to do so, which is basically C++ code.
所以我的问题是如何在 C 中使用 IDispatch 来创建 COM 对象,而不必依赖于 MFC、.NET、C#、WTL 或 ATL.我相信如果我这样做,我将能够毫无问题地编译我的代码.
So my question is how can I use IDispatch in C to create the COM object without having to depend on MFC, .NET, C#, WTL, or ATL. I believe that if I do so I will be able to compile my code without any problem.
推荐答案
CodeProject 上有一篇很棒的文章,题为COM in plain C".
There is a great article on CodeProject entitled "COM in plain C".
这里是第 1 部分的链接.
在那篇文章和作者的后续跟进中有很多关于在 C 中使用 COM 的非常好的信息(我认为该系列中有 3 或 4 个).
There is a lot of very good info on working with COM in C in that article and the author's subsequent follow-ups (I think there are 3 or 4 in the series).
我错了,有 8 个部分!
I was wrong, there are 8 parts!
第 2 部分
第 3 部分
第 4 部分
第 5 部分
第 6 部分
第 7 部分
第 8 部分
这篇关于如何在纯 C 中使用 IDispatch 来调用 COM 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!