English 中文(简体)
B. 视觉C++项目类型
原标题:Visual C++ project type to be used for interop

我正试图从C#和C++/CLI中学习Interop。 我开始创建C++/CLI项目。 然而,我发现,大多数例子都表明,在2010年视觉C++项目模板下,我没有看到任何类型的COM。 任何想法? 而且,我也只能创建视觉C++ 教室项目为此目的使用?

最佳回答

你们正在把它混在一起。 三种不同的办法,即与管理方案相提并论,但并非同时使用:

  • pinvoke through the [DllImport] attribute. Good for C style native APIs
  • interop through COM. Very well supported by the CLR as long as it is the Automation subset and you have a type library. Just works out of the box, no work needed. Adding COM to existing native code that isn t COM enabled is not productive unless you already have good COM programming skills (know ATL)
  • wrapper classes created in the C++/CLI language. When the above options are not enough. Required for interop with native C++ classes.

学习足够的C++/CLI以完成这项工作需要大约3周,真正学习语言是一项多月的工作。 在你刚用它来做包装时,需要着重注意的事项是:管理“彩色”,正确使用帽子,以及“谁”与“谁”之间的区别。

了解更多情况可能值得你的时间,这些合成物与C++/CX的合成物非常相似,后者是MSVC++汇编者增加的语言延伸,支持Windows的成像。 8. 了解C++/CLI是了解C++/CX的95%。

https://stackoverflow.com/questions/2691325/c-cli-mixed-mode-dll-production/2691448#2691448>。

问题回答

暂无回答




相关问题
How can i add a button to all windows explorer instances?

I am trying to add a button to one of the existing tool bars in any windows explorer instance. After much research i figured out that BHO (browser helper objects) are the best way to hook to ...

Implement a Comet server in C#

I would like to know whether there is a way to write a comet server in C#. i have a C# code that generates data periodically, and I want to push these data to a java app. So would like to convert my C#...

Getting a byte array from out of process C++ COM to C#

What s the best way to get a chunk of memory (i.e. void*) from a COM server to C#? We have been using an IStream (using CreateStreamOnHGlobal) and passing that back, which worked. However when we ...

Using Unreal 3 Engine within a .NET application

Now that the Unreal Development Kit for Unreal 3 engine is free I am thinking about utilizing it for an appication. Do you think it is possible to emebedd a Unreal 3 powered 3D window into a .NET (WPF ...

Excel Interop "FindAll" Method

This may be a duplicate question, but really don t know how else to word the title. Has anyone been able to find a method in the Excel Interop Library that exposes the "Find All" functionality from ...

How should I declare this C struct for interop?

I have to use a legacy C routine in the application I am developing. The code in here works, but I have to convert almost all the fields to char arrays in order to use it. There is a better way to do ...

热门标签