Search code examples
.netc++cominteropwindows-media-player

Using a C++ header with .NET language


I trying to use a ".h" file from Windows SDK in a .NET language (maybe C#), but without success. This header exposes some Windows Media player functionality through COM. If I use Win32 C++, I can use it with no problems, so I thought that I could use Managed C++ as a "Bridge" to expose it to C#.

The header file is the subscriptionservices.h that comes with Windows Media Player SDK 11 (part of Windows SDK 6).

Is that possible? How could I use that header file in a .NET Application?

Thanks, Eduardo Cobuci


Solution

  • You can use PInvoke to Interop with Win32. If you are trying to use a COM object you should be able to add a reference to the project. Have you looked at this article?

    More practically you need to understand the kind of work that you are doing. If you are going to be doing lots of pointer arithmetic then I would recommend managed c++. If not C#. Good luck.