Groups | Blog | Home
all groups > dotnet interop > february 2004 >

dotnet interop : can I use MFC Controls in WinForms


Thomas
2/26/2004 9:38:17 AM
Hi there,

is there a possibility to host MFC controls in a SWF Control?
I have a big MFC application and want to migrate to .NET. It is not possible
for me to rewrite all the MFC controls and views so I want to create a new
..NET based frame and use the old MFC controlbars and editors.
Is there a way (e.g. with subclassing / superclassing) to create a managed
wrapper around my old MFC CWnd and CVeiw derived classes?
I know that I could create ActiveX controls around them and use a RCW but
that would cause a lot of additional overhead.
There are some atricles saying that Whidbey bring support for hosting SWF
Controls in MFC. Is that also true for the oposite (MFC Controls in SWF)?

Thanks in advance

Thomas

v-yiy NO[at]SPAM online.microsoft.com (
2/27/2004 5:30:25 AM
Hi Thomas,

Mixing MFC and Windows Forms this way is not a good model and you will
be running into problems. If you have a fairly huge MFC based UI
application, my recommendation would be to continue to use unmanaged code
for UI enhancements or host Winform control in your MFC applications,
since MFC 7.1(in VS.NET 2003) is a supported unmanaged host in .NET
Framework v1.1, Please refer to this article to see how to host a winform
control in a MFC application:
http://msdn.microsoft.com/msdnmag/issues/03/03/WindowsForms/default.aspx

Thanks!



Best regards,

Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
Thomas
3/3/2004 8:42:23 AM
Thank you very much.
After your advice and some additional tests its now clear to me that a
mixture is not a good idea. I think the best way for me is to replace the
whole UI and introduce a wrapper between the UI part and the functional part
using managed C++ (IJW).

Greetings from Germany
Thomas


[quoted text, click to view]

AddThis Social Bookmark Button