Reputation: 396
After a bunch of reading this afternoon, and not getting any tangible results. Is it possible to host a windows forms dialog inside of a MFC application that is still being developed using VC6.
The issue arises is that we have a large application that has never been upgraded with the new Visual Studios because VC6 always worked. Now we need to add some of the C# functionality in it. I am unable to do the /clr option as our project consists entirely of unmanaged C++. I did a search for "CWinFormsControl" within all our libraries/headers and didn't come up with anything. I am unsure what to try next.
Also, forgive any ignorance as I am doing research and new to this depth of programming.
I have checked the following articles:
Upvotes: 0
Views: 1129
Reputation: 15281
CWinFormsControl requires MFC 8.0.
You can make your managed assembly a COM server (e.g. ActiveX) and use it in MFC application like any other COM server.
Upvotes: 2
Reputation: 10875
I don't have VC6 laying around to try this out, but I think it should be mostly possible; at least for a simple modal ShowDialog() scenario.
You'll create a new assembly/DLL using C++/CLI, compiled with the /clr flag. This will expose an unmanaged API to your existing MFC code, using the usual __declspec(dllexport)
. The implementation will call into your C# code which lives it yet another assembly.
Upvotes: 1