Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I need to use some functionalities of the littlenavmap application in a c# project.

I need to know how this can be done and what would be the best way to accomplish this:
1. A tool like QtSharp/CppSharp/SWIG
2. Compiling as C++/Cli project which can then be invoked from c#
3. Wrapping the code but i don't know how

What I have tried:

As I am very new to both technologies, I have just reached the stage where I know a few ways in which this might be approached
Posted
Updated 12-Nov-18 0:31am

Hi I did this several times for even very big projects that they were based on MFC/C++ and I migrate them into C#.Net by using C++/CLI. Please follow the below link which is one of my Tips/Tricks and come back to me if you still need help. Note that this short article is talking about hosting Windows form in MFC but the other way around is also applicable by using C++/CLI.
Hosting Windows Forms User Control in MFC Dialogs[^]

For more detail information you can read this article:
Hosting of MFC MDI Applications from Within WinForms and WPF Applications[^]

If you are in Qt then this link will be useful as well:
Qt Windows Forms Interop Framework[^]

Cheers,
AH
 
Share this answer
 
v3
Comments
anupama lite iyer 12-Nov-18 3:44am    
Thank you for the response. This is the application and can be built only with Qt Creator:
https://github.com/albar965/littlenavmap
Would it still be possible?
Aydin Homay 12-Nov-18 4:03am    
Hi again, I updated the solution for you check it please. if it worked please don`t forget to accept solution to make it a valid solution for others as well.
Aydin Homay 12-Nov-18 3:57am    
In this case, since the presentation layer is in Qt I am not sure if the solution that I suggested will work. It requires more research. My first guess would be NO but who knows so many technologies and cross-compilers are out there in the Internet. Give it a try and see if you can find any link that leads you to use/integrate/mix a Qt application in .Net.
You must make the decision on what parts and how much of the C++ project you need in C#.

If you only need some functions than my C# Interoperability article may interest you which is more like wrapping some funtionality. I wrote another article about C++/Cli interoperability but it was for Windows phone. But the technique should be the same.

The usage of some Qt makes only sense, when it is already in code. Adding another framework makes your code more complex and opaque.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900