使用c ++ dll,c#项目和一个com对象 [英] Using c++ dll, c# project and a com object together
问题描述
我需要使用com对象进行进程间通信。
在我的项目中我创建了
a c ++ dll,
a c ++ / cli在c中使用该dll的接口#
我的项目正在c#
现在我需要使用com对象(用于Windows系统中的进程间通信目的)但我不知道如何将它们与我现有的项目模型一起使用。
i我正在学习如何创建com对象和所有,但很难理解我如何在现有项目模型中使用它们,我发现的所有源代码似乎都建议如何创建一个新的com对象然后使用它
进一步澄清我的问题:我想在我现有的c#项目中使用com接口,而不是从头开始创建一个新项目。
我是否需要修改我的项目或任何其他想法表示赞赏。
i是com对象的新手,现在就学习它。
i have need to use com objects for the inter process communication purpose.
In my project i have created
a c++ dll,
a c++/cli interface for using that dll in c#
and my project is being developed in c#
now i need to use com objects(for inter process communication purpose in windows system) but i am not sure how i can use them with my existing project model.
i am learning how to create com objects and all, but having difficulty understanding how can i use them with my existing project model, all the sources i found seems to suggest how to create a new com object and then use it etc.
to further clarify my question : i want to use com interface with my existing c# project instead of creating a new project from beginning.
do i need to modify my project or any other ideas are appreciated.
i am new to com objects and learning it now.
推荐答案
如果你得到它会更清楚摆脱cli-stuff只使用从C#调用的C ++。
这很简单,因为我写了一个文章和演示代码。还有这个文章值得一读,即使它是相反的方式,如果你考虑修改你的com。
将您的com对象创建为全局对象指针。
It will be clearer if you get rid of the cli-stuff and only use a C++ which gets called from C#.
It is quite simple possible, as I wrote an article and demo code about it.Also this article is worth reading even it is the opposite way, if you consider modiying your com.
Create your com-objects as global object pointers.
这篇关于使用c ++ dll,c#项目和一个com对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!