Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is WinForms programming in Visual C++/C# different from Windows programming in Visual C++(MFC)

Tags:

c#

visual-c++

mfc

How is winforms programming in visual c++/c# different from windows programming in visual c++(MFC).

Also I want to know whether C# is strong enough to do Windows programming as in other than forms.


2 Answers

There are a few notable differences:

  • You'll eventually be more productive as it is much easier to do (.net)
  • The language helps you from making a lot of common mistakes (null pointers, overflows, leaks)
  • The framework is a lot (and really I mean a lot) more clean than MFC
  • In essence you can do almost anything. The least common 0.01% of things you need to do through direct win32 DLL invokes (or use a wrapper or library someone else made)
like image 154
Toad Avatar answered Feb 23 '26 13:02

Toad


I'm not sure if anyone can give one single answer to this question, I can just try to point out a few of the many differences:

  • C# and C++ are quite different: Memory management, package structure, class layout, events/delegates, generics/templates... Even writing non-GUI apps is completely different in C++ and C#. Many of the features of the C# language are very helpful if not even designed for GUI development.

  • Winforms has a very good visual designer support if compared to MFC. For 95% of all apps, you'll be a lot more productive using winforms. This is especially true for custom controls (either your own or third party)

  • MFC on the other side provides more framework support (document/view structure etc.).

  • For some applications, MFC apps may seem more responsive. In most of these cases, a winform application can be optimized to have the same performance, but this is above the average winforms developer level (which is generally lower than the knowledge level of MFC programmers).

  • MFC encapsulates the WIN32 API more directly than Winforms do. There are cases where you need to access the WIN32 API even from winforms directly. Then it is not always clear (and not well documented), how to do this. Again, a typical winforms programmer has less knowledge of the WIN32 API than a MFC programmer, so in these cases he will run into troubles more likely.

  • I think winforms is well supported and you can solve pratically all GUI/NON-GUI tasks. For most tasks, it will be easier to write a C# program.

I'm sure, there are much more arguments pro/contra, I just noted the few that came into my mind...

like image 38
MartinStettner Avatar answered Feb 23 '26 11:02

MartinStettner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!