[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1396
  • Last Modified:

Migrate VC++ 6.0 MFC code to C#.NET Guide?

I have written a huge amount of generic tools in VC++ 6.0 that derive from MFC classes.  Needless to say, I love my tools, but now I'm facing a situation where I cannot use my existing code for my largest client.  I am *required* to use C#.NET.  I've been porting my most critical classes to C#.NET and I'm having some success, but it's slow and painful.  In all my searching, I cannot find any good resource for migration.  What I'm looking for is just this:  A table that shows two columns, Column 1: MFC, Win32, etc., Column 2: C#.NET Equivalent.  For example (I know these are pretty obvious...):

Win32:
GetSystemMetrics = System.Windows.Forms.SystemInformation

MFC:
CRect = System.Drawing.Rectangle
CWnd::GetClientRect = System.Windows.Forms.ClientRectangle
CArray = System.Collections.CollectionBase (sortof)

etc.

  I've spent over 20 hours in the past month searching for such a beast, can anyone help?  Thanks!

Douglas Holt
douglasholt@cox.net
0
DouglasHolt
Asked:
DouglasHolt
  • 4
  • 4
1 Solution
 
Chester_M_RagelCommented:
0
 
DouglasHoltAuthor Commented:
 Useful, yes.  I've read it.  The differences between C++ and C# I've gotten past.  I'm looking for a listing that shows the MFC classes and how they translate to C#.NET, which would be Windows.Forms.  Also, there are lots of Win32 commands that I've always used, and now I have to figure out how the .NET framework exposes these functions.  I can't find a translation table anywhere.  I am slowly building my own, but there are tons left and I have to research each one separately.   It's killing me for time.

  Keep the ideas rolling!!!  Thanks again.
0
 
DouglasHoltAuthor Commented:
Another note:  I'm slowly coming to the conclusion that there are no decent guides for migrating from VC++ with MFC to C# with Windows.Forms because C# with Windows.Forms is severly lacking compared to VC++ with MFC.  Please, someone tell me I'm wrong!!!
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Chester_M_RagelCommented:
I think you are true about fact. But I can't accept the reason for that...
0
 
DouglasHoltAuthor Commented:
Chester,

  Sorry, I'm don't quite understand your last comment...  I still need to migrate my code to C#.NET using Windows.Forms, my client *requires* it.  I'm just trying to understand why there are no migration guides.  And if there are, where are they?  Any help in the right direction will be of great value.
0
 
Chester_M_RagelCommented:
I found a palce at last I think :)... I said so b'cos you can find equivalents for most of the MFC in C#..

http://www.flounder.com/csharpfactoids.htm
0
 
DouglasHoltAuthor Commented:
<< I found a palce at last I think :)...  >>

  Excellent!  Yes, just what I've been looking for.  I'll contribute the map I've been creating to his efforts...

<< I said so b'cos you can find equivalents for most of the MFC in C#.. >>

  Sorry, I guess I was just frustrated at the moment due to lack of template classes like CArray.  Using CollectionsBase to create a strongly typed array is a lot of work when you're used to one line like the following:

typedef CArray<CMyClass, CMyClass> CMyClassArray;

  Oh, so elegant and extremely powerful.  But alas, C# has no way to do this.  I would love to be shown the light if I'm missing something!

  Thanks again for your help, I accept your answer and award you the points!

Douglas Holt
douglasholt@cox.net


0
 
Chester_M_RagelCommented:
Thats true.. I think they are comming up with good template classes in .NET Framework 2.0..

I'm happy that you got a good guide fo finish your work... Good luck,

Chester.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now