Using VCProjectEngine and COM

不想你离开。 提交于 2019-12-14 04:08:08

问题


I am trying to use the COM system for VCProjectEngine. It is pretty simple to use in C# but I am hitting a wall in native C++.

I am using the COM system and so far I was able to get a pointer to the VCProjectEngine interface using the CoCreateInstance function.

But now what should I do with this interface? I would like to access the VCProject interface to be able to add files to the project. I tried to go with LoadProject or CreateProject but it takes a IDispatch parameter not a VCProject one.

Can someone help me with that?


回答1:


Calling COM interfaces from C++ can be done in a number of different ways:

  1. "low-level" COM calls using CoCreateInstance and the IUnkown interface
  2. ATL (Active-X Template Library) which provides a number of smart pointers and utility functions to make the job a lot easier. Use in conjuction with #import to generate wrapper classes for you.
  3. For Windows Store Apps you should use C++/Cx or WRL (Windows Runtime C++ Template Library)

There are many good tutorials and code samples on MSDN.



来源:https://stackoverflow.com/questions/22283615/using-vcprojectengine-and-com

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!