469,925 Members | 1,466 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,925 developers. It's quick & easy.

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 6607
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
"InitializeComponent" 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 "IsBackgroundThread" 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*********@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
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
InitializeComponent 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**************@TK2MSFTNGP09.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
"InitializeComponent" 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 "IsBackgroundThread" 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*********@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
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*********@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
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
InitializeComponent 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**************@TK2MSFTNGP09.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
"InitializeComponent" 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 "IsBackgroundThread" 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*********@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by GAD | last post: by
4 posts views Thread by susmita_ganguly | last post: by
4 posts views Thread by Azhar Bilgrami | last post: by
8 posts views Thread by Scott | last post: by
1 post views Thread by billb | last post: by
3 posts views Thread by daveboyd | last post: by
1 post views Thread by garethdjames | last post: by
1 post views Thread by Bonggoy Cruz | last post: by
reply views Thread by jsmith | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.