473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

C# control in MFC Window/Frame

I have an existing MFC based application that I prefer not to change much.
For some new functionalities in this application, I'd like to write in C#.
Potentially there are substantial two-way data exchanges between the existing
MFC components and the new C# ones. In addition, I'd like the C# Forms based
controls and windows to behave reasonably consistent with the MFC app. So I
have the following questions and many thanks in advance:

1. Is this something doable or to avoid?
2. I'm optimistic so assuming doable, any recent and detailed (w/ examples)
articles (in addition to and hopefully newer than
http://msdn.microsoft.com/msdnmag/issues/05/04/C)?
3. Would I be able to control whether the C# control float out of the main
window or not? (this one is probably too specific)
4. .NET 2.0 improvements in related areas?

Thanks again,
--
Bill
Dec 1 '05 #1
6 6025
I think......
You might create you Control in C#, make it COM visible (the default).
Instantiate in in C++ through COM (no idea on how to achieve that), ask for
its handle (Control.Handle). that would give you a HWND.
Which you could, then, insert into your hierarchy.
"Bill" <by****@newsgroups.nospam> wrote in message
news:32**********************************@microsof t.com...
I have an existing MFC based application that I prefer not to change much.
For some new functionalities in this application, I'd like to write in C#.
Potentially there are substantial two-way data exchanges between the
existing
MFC components and the new C# ones. In addition, I'd like the C# Forms
based
controls and windows to behave reasonably consistent with the MFC app. So
I
have the following questions and many thanks in advance:

1. Is this something doable or to avoid?
2. I'm optimistic so assuming doable, any recent and detailed (w/
examples)
articles (in addition to and hopefully newer than
http://msdn.microsoft.com/msdnmag/issues/05/04/C)?
3. Would I be able to control whether the C# control float out of the main
window or not? (this one is probably too specific)
4. .NET 2.0 improvements in related areas?

Thanks again,
--
Bill

Dec 1 '05 #2
Hi Bill,

As far as I know, Microsoft .NET 1.0 Windows Forms controls are supported
in Windows Forms and Internet Explorer 5.01 and later versions. .NET 1.1
Windows Forms controls are supported in Windows Forms, Microsoft Foundation
Classes (MFC) 7.x, and Internet Explorer 5.01 and later versions. Other
applications and development tools that are capable of hosting ActiveX
controls, including the ActiveX Test Containers from versions of Visual
Studio that are earlier than Visual Studio .NET 2003, are not supported
hosts for .NET Windows Forms controls.

The supportability information in this article also applies to the use of
..NET controls through COM Interop. The use of a .NET control through a COM
Callable Wrapper (CCW) is supported only in Internet Explorer. For more
information on this please see article 317346 listed below.

However, using .NET controls in an MFC based application is NOT
recommended. Only MFC 7.1 and later versions support this. And also there
might be some unexpected behaviours in doing this. You can check the
following link for more information:

http://support.microsoft.com/default...B;EN-US;311334

http://support.microsoft.com/kb/839076/

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 1 '05 #3
Thanks, Kevin.

I should clarify. Othe MFC side, it's 7.1. I intend to use .NET 2.0. I'm
hoping this will make things better. On the other hand, I'm afraid someone is
going to tell me I'd have to either have 8.0/2.0 or 7.1/1.1 combinations.

--
Bill
"Kevin Yu [MSFT]" wrote:
Hi Bill,

As far as I know, Microsoft .NET 1.0 Windows Forms controls are supported
in Windows Forms and Internet Explorer 5.01 and later versions. .NET 1.1
Windows Forms controls are supported in Windows Forms, Microsoft Foundation
Classes (MFC) 7.x, and Internet Explorer 5.01 and later versions. Other
applications and development tools that are capable of hosting ActiveX
controls, including the ActiveX Test Containers from versions of Visual
Studio that are earlier than Visual Studio .NET 2003, are not supported
hosts for .NET Windows Forms controls.

The supportability information in this article also applies to the use of
.NET controls through COM Interop. The use of a .NET control through a COM
Callable Wrapper (CCW) is supported only in Internet Explorer. For more
information on this please see article 317346 listed below.

However, using .NET controls in an MFC based application is NOT
recommended. Only MFC 7.1 and later versions support this. And also there
might be some unexpected behaviours in doing this. You can check the
following link for more information:

http://support.microsoft.com/default...B;EN-US;311334

http://support.microsoft.com/kb/839076/

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 1 '05 #4
Hi Bill,

As far as I know, we can use MFC 7.1 with .NET 2.0 controls. But we don't
recommend to use .net controls in MFC, since there might be some unexpected
issues during the interop.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 2 '05 #5
I'm not sure I follow. MS doesn't recommend .NET controls in MFC. So what's
the recommended way to develop C# components in an existing MFC application?
Just don't do it?

--
Bill
"Kevin Yu [MSFT]" wrote:
Hi Bill,

As far as I know, we can use MFC 7.1 with .NET 2.0 controls. But we don't
recommend to use .net controls in MFC, since there might be some unexpected
issues during the interop.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 3 '05 #6
Hi Bill,

From our experience, there might be some unexpected issues when doing this.
So it's just not recommended to do so. It's better to use an ActiveX
control than hosting a .NET control.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 3 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Reply Via Newsgroup | last post by:
Folks, I am specifically using an IFRAME but am also interested if this is possible via a window opened using window.open Basically - I have a popup window that I use for uploads - When an...
2
by: cschang | last post by:
I am not sure this is the right place to ask this question. I have a web page composed with two frames (left and right). Then in my frmae2(right one) , I open a pop-up window by javscript:...
4
by: ced | last post by:
Hallo, I have some JS which creates a new 2-frame window. The new window (via onLoad) backfills a variable in the parent window so I'll know when it's safe to load the target frame. The...
3
by: James | last post by:
Does anyone know if it is possible, in C#, to use a customized window frame? For example, programs like Winamp and AdAware do not use the standard box window frame, but a customized design. ...
1
by: Gibs | last post by:
Can i put a user control in frame? when i tried to do it was giving an error message Server Error in '/MyTestApp' Application....
2
by: RC | last post by:
When you have a large table, you have to scroll the vertical and/or horizontal scroll bar(s) to read the table contents <td> tag. But the problem is you can't see the column header <th> tag when...
2
by: ABC | last post by:
I have a default page which has two frame pages. On the plan, I expected it will forward to login page which show on one frame page only if the users don't login. In fact, both two frame pages...
1
by: bushticals | last post by:
i'm new to python... im making a GUI for an image information editing program that i am doing for school. i have a button in my menu bar that i want to open a new window (same GUI) just like in...
1
by: =?Utf-8?B?TW9ydGVuIFdlbm5ldmlrIFtDIyBNVlBd?= | last post by:
"Eric B." wrote: Hi Eric, The window frame is hidden by setting the FormBorderStyle property to FormBorderStyle.None -- Happy Coding!
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.