How to use C++ class in Windows 10 C# universal ap

2019-06-20 17:14发布

问题:

I want to execute a method from cpp class in my Windows 10 C# Universal app. As i'm a newbie in Windows app development and C#, so i can use some code to understand the method.

回答1:

You need to:
1- Create a new Windows Universal Runtime Component DLL, using C++/CX
2- Add a new ref class to it. This class will be a wrapper to your C++ code.
3- Call your C++ method from that new class
4- Add a reference to the new DLL from your C# project, and use the C++/CX wrapper class from there.