Click to See Complete Forum and Search --> : VC++ MFC project ---> C# (+ is it worth it)


MattG
December 9th, 2002, 05:11 PM
Hi all,

I have a dialog based application (MFC) that is about 25% complete (200 files at present). I came to the point where i needed to write the code for printing invoices and reports through crystal.

Having read all text available, MS don't seem that interested in VC++ and Crystal. Further investigation makes me believe MS are going to kick MFC into touch.

Bearing all this in mind. Does anyone know of a way in which i can write the rest of my project in C# while accessing the files and resources already written in VC++. The project is currently unmanaged (ported over from VC++6), though i believe i can convert it to managed easy enough.


PS. Does anyone have opinions on whether i should port over to C# or stay with VC++ (MFC) and try and hunt the oh so rare documents on how to use VC++.NET with crystal

Thanks
Matt

MartinL
December 10th, 2002, 10:42 AM
Hm. That is a problem. You cannot convert the MFC project to the managed C++ (or C#) project. It is not possible due to architecture of the MFC. It is not designed to work in managed environment!

However, you can encapsulte all functionality provided by the MFC application into the COM objects and use thouse COM objects by your C# code... And I think, that is only possible way how to use MFC code in the C# application.

Martin

WillemM
December 16th, 2002, 05:31 AM
You will have to rewrite your application...
But it's sure worth it.

Less lines of code and more easy to write.
And ofcourse it's pure .NET which simply means: faster,better and compatible with future OS versions. I heard that you can also run .NET applications on Mac OSX and linux... but I haven't tested that yet.

MartinL
December 16th, 2002, 07:15 AM
Yes, it is true..

Microsoft is porting .net framework for mac os as well as for linuxes... :)

MattG
December 16th, 2002, 02:19 PM
The MFC & VC++ book s have now been placed on the back shelf, and i am half way through my C# book (Wrox). If its been ported to the other platforms then i think .NET is the only way to go.

Cheers

Matt

pareshgh
December 16th, 2002, 03:23 PM
Martin,
even I had a problem with VB 6.0 and C#. what my problem was ,

I had the whole project which was developed in VB 6.0 and I am converting + adding new stuffs in it. I thought i would easily convert VB code to VB.NET and copy all screens to C# GUI and modify. but it isn't really easy. I am just kind of trying a small project with 5-10 .frm files (VB project files) converting in VB.NET. by converting I mean is if you open a VB.OLD project in new .NET then it will ask for converting. But it takes too much time. even if it takes too much time on faster processor its ok ! but I tried to convert the whole project screens and kept the conversion for 1 whole day + left overnight !!!!
It just hangs or gets stuck somewhere ? I don't know !! but never finishes ...

note. the old project does have some ActiveX controls and inbuild VB ocx.

- any pointers for this ?

thanks
Paresh