473,769 Members | 6,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Migration from MFC to C# Windows Forms

I have written windows applications using MFC for several years and
have frequently used MFC techniques.

Now I'm moving to C# .NET WinForm. Mostly C# books describes C#
language (sometimes compared with C++) and then how to use Windows
Forms but without comparison with MFC.

Would you recommend any book or online stuff to guide migration from
MFC/Win32 to Windows Forms to save time and effort to learn new
environment. I realized that it is next to impossible to map
mechanically. At this time all I need conceptual migration or hints.

Examples I need are as follows (Right hand side answer could be
incorrct, because I'm a newbie)

MFC => .Net Windows Forms
MainFrame => ???
DOC/VIEW architecture => Nothing. Just dialog
Dialog resource file => Hard coded in C# file
CString => ???
Notify Message => Event...
Worker/UI thread => ???
ANSI/Unicode => ???
Timer => ???
Nov 15 '05 #1
3 7038
Well, although not a perfect match, here are the C# versions of MFC concepts

MainFrame: Form (that would be the main Form)
Doc/view: The wizard doesn't do this for you but you can always have this
architecture if you want.
Dialog resource file: You have everything written out to the
"InitializeComp onent" method of the Form that's being designed.
CString: string
Notify Messages: You're right. They come as events.
Worker/UI threads: You set the "IsBackgroundTh read" to true for worker and
false for UI (well, that's the general usage, although there's not a whole
lot of difference between the two; Background threads don't keep a process
alive without atleast one foreground thread)
ANSI/Unicode: You set the Encoding. Look up System.Text namespace
Timer: Timer. Windows Forms has a Timer component that you can add to any
Control.

Since you have plenty of experience in MFC, the samples in MSDN and the
Tutorials should be good enough to get you started off with C#.

Good luck!
-vJ
"Scott" <ba*********@ho tmail.com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
I have written windows applications using MFC for several years and
have frequently used MFC techniques.

Now I'm moving to C# .NET WinForm. Mostly C# books describes C#
language (sometimes compared with C++) and then how to use Windows
Forms but without comparison with MFC.

Would you recommend any book or online stuff to guide migration from
MFC/Win32 to Windows Forms to save time and effort to learn new
environment. I realized that it is next to impossible to map
mechanically. At this time all I need conceptual migration or hints.

Examples I need are as follows (Right hand side answer could be
incorrct, because I'm a newbie)

MFC => .Net Windows Forms
MainFrame => ???
DOC/VIEW architecture => Nothing. Just dialog
Dialog resource file => Hard coded in C# file
CString => ???
Notify Message => Event...
Worker/UI thread => ???
ANSI/Unicode => ???
Timer => ???

Nov 15 '05 #2
Thank you everyone

More questions:

What is recommended solution to build multi-language application? In
MFC, multiple resource file and corresponding DLL file was used. But
in C#, text segments seem to be hardcoded in C# source code - in
InitializeCompo nent as mentioned by Vijaye Raji.

Does .NET use message queue and pump to dispatch events in a main
thread? And is event similar to Windows message? or somewhat different
concept like virtual function?
In MFC, OnTimer is invoked by main thread message queue- eventually,
thread safe with only one thread. Same in C#? or is another thread
used?

Thanks again

Scott

"Vijaye Raji" <no************ @hotmail.com> wrote in message news:<#U******* *******@TK2MSFT NGP09.phx.gbl>. ..
Well, although not a perfect match, here are the C# versions of MFC concepts

MainFrame: Form (that would be the main Form)
Doc/view: The wizard doesn't do this for you but you can always have this
architecture if you want.
Dialog resource file: You have everything written out to the
"InitializeComp onent" method of the Form that's being designed.
CString: string
Notify Messages: You're right. They come as events.
Worker/UI threads: You set the "IsBackgroundTh read" to true for worker and
false for UI (well, that's the general usage, although there's not a whole
lot of difference between the two; Background threads don't keep a process
alive without atleast one foreground thread)
ANSI/Unicode: You set the Encoding. Look up System.Text namespace
Timer: Timer. Windows Forms has a Timer component that you can add to any
Control.

Since you have plenty of experience in MFC, the samples in MSDN and the
Tutorials should be good enough to get you started off with C#.

Good luck!
-vJ
"Scott" <ba*********@ho tmail.com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
I have written windows applications using MFC for several years and
have frequently used MFC techniques.

Now I'm moving to C# .NET WinForm. Mostly C# books describes C#
language (sometimes compared with C++) and then how to use Windows
Forms but without comparison with MFC.

Would you recommend any book or online stuff to guide migration from
MFC/Win32 to Windows Forms to save time and effort to learn new
environment. I realized that it is next to impossible to map
mechanically. At this time all I need conceptual migration or hints.

Examples I need are as follows (Right hand side answer could be
incorrct, because I'm a newbie)

MFC => .Net Windows Forms
MainFrame => ???
DOC/VIEW architecture => Nothing. Just dialog
Dialog resource file => Hard coded in C# file
CString => ???
Notify Message => Event...
Worker/UI thread => ???
ANSI/Unicode => ???
Timer => ???

Nov 15 '05 #3
Inline

-vJ

"Scott" <ba*********@ho tmail.com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
Thank you everyone

More questions:

What is recommended solution to build multi-language application? In
MFC, multiple resource file and corresponding DLL file was used. But
in C#, text segments seem to be hardcoded in C# source code - in
InitializeCompo nent as mentioned by Vijaye Raji.
You set the Form's property, "Localize" to true. A resource file will be
created for all the data and will be read from there. So, when you change
languages, you localize only the resource files

Does .NET use message queue and pump to dispatch events in a main
thread? And is event similar to Windows message? or somewhat different
concept like virtual function?
Events are very high level wrappers. Under the hood, Windows messages still
exist.
In MFC, OnTimer is invoked by main thread message queue- eventually,
thread safe with only one thread. Same in C#? or is another thread
used?
I'm not sure about this one... but I'd hazard a guess that the same WM_TIMER
message is being used in C#.
Thanks again

Scott

"Vijaye Raji" <no************ @hotmail.com> wrote in message

news:<#U******* *******@TK2MSFT NGP09.phx.gbl>. ..
Well, although not a perfect match, here are the C# versions of MFC concepts
MainFrame: Form (that would be the main Form)
Doc/view: The wizard doesn't do this for you but you can always have this architecture if you want.
Dialog resource file: You have everything written out to the
"InitializeComp onent" method of the Form that's being designed.
CString: string
Notify Messages: You're right. They come as events.
Worker/UI threads: You set the "IsBackgroundTh read" to true for worker and false for UI (well, that's the general usage, although there's not a whole lot of difference between the two; Background threads don't keep a process alive without atleast one foreground thread)
ANSI/Unicode: You set the Encoding. Look up System.Text namespace
Timer: Timer. Windows Forms has a Timer component that you can add to any Control.

Since you have plenty of experience in MFC, the samples in MSDN and the
Tutorials should be good enough to get you started off with C#.

Good luck!
-vJ
"Scott" <ba*********@ho tmail.com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
I have written windows applications using MFC for several years and
have frequently used MFC techniques.

Now I'm moving to C# .NET WinForm. Mostly C# books describes C#
language (sometimes compared with C++) and then how to use Windows
Forms but without comparison with MFC.

Would you recommend any book or online stuff to guide migration from
MFC/Win32 to Windows Forms to save time and effort to learn new
environment. I realized that it is next to impossible to map
mechanically. At this time all I need conceptual migration or hints.

Examples I need are as follows (Right hand side answer could be
incorrct, because I'm a newbie)

MFC => .Net Windows Forms
MainFrame => ???
DOC/VIEW architecture => Nothing. Just dialog
Dialog resource file => Hard coded in C# file
CString => ???
Notify Message => Event...
Worker/UI thread => ???
ANSI/Unicode => ???
Timer => ???

Nov 15 '05 #4

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

Similar topics

2
2735
by: GAD | last post by:
Following our conversation here are my questions: I would like to migrate an application that runs on windows XP to PDA. I would like to use pocket PC 2003 in order to get support for VOIP My questions are: 1. Does pocket PC 2003 implements WINRTP ? Can I use a proprietry signalling protocol on top of it? 2. This project also involves the using of Microsoft
4
19994
by: susmita_ganguly | last post by:
Hi I am trying to upgrade from oracle 8i to oracle 9i on the same server ..I don't know much abt migration . Can anyone help me out. Thanks. Susmita
4
3921
by: Azhar Bilgrami | last post by:
Dear Hi: Hope to see u in good health. " I want to migrate a database which is currently running Unix as Operating System and Oracle ver 6 as Database, it is also using oracle froms version 3 (text base) as Front End" Now here is what I want to do " I want to migrate that database from Oracle for Unix to Oracle for Linux With retaining all the Forms, in other words all I want
8
712
by: Scott | last post by:
I have written windows applications using MFC for several years and have frequently used MFC techniques. Now I'm moving to C# .NET WinForm. Mostly C# books describes C# language (sometimes compared with C++) and then how to use Windows Forms but without comparison with MFC. Would you recommend any book or online stuff to guide migration from MFC/Win32 to Windows Forms to save time and effort to learn new environment. I realized that...
1
3723
by: billb | last post by:
Hello all, Does anyone have any C# code to replace this working VB6 code ... when i move it to VB.NET is does not work as illustrated below. Ineed to keep the form or web form window on top until a button is clicked? Thanks in advance... :)
3
1973
by: daveboyd | last post by:
Hi! I have an MFC application that is under development in VS2003 and frankly MFC seems difficult to use and poorly documented -- I frequently find the only way to get example code is on the Internet, not in the huge, mosly useless "MSDN Library". For example, I was advised to use CStatic for drawing some color frames / backgrounds, but CStatic isn't on the Toolbox and for those related components such as Picture, limited frame colors...
1
1470
by: garethdjames | last post by:
I work for a large organisation where we use .Net 1.1 as our sole development language. We have many frameworks and applications and web sites that are developed in .Net 1.1 These developments are by no means trivial, they are the result of an IT department of over 300 people and 2 years of development It is my responsibility to develop a strategy to move to .Net 2.0, this
1
3875
by: Bonggoy Cruz | last post by:
We have a fairly big size ASP.NET web application that was written VB.NET. We are in the process converting the web project. We used the migration wizard included in VS 2005. I followed step by step guide outlined in here: http://msdn.microsoft.com/asp.net/reference/migration/upgrade/default.aspx?pull=/library/en-us/dnaspp/html/webprojectsvs05.asp. I was able to convert the project without any problem. Compiling and building them is...
0
1515
by: jsmith | last post by:
hi all i use delphi for win32 applications and C for microcontrollers. i going to migrate to C for windows (and linux soon), while developing from win32 to DotNet. there are several compilers Borland C++ Borland C# Visual C C Sharp
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10222
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10050
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9999
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.