views:

267

answers:

8

I've been a Unix-based web programmer for years (Perl and PHP). I'm also competent with C and C++ (and bash and that sort of sysadmin sort of stuff) in terms of the language itself. I've never had a problem learning a new language (I mucked around with Java a few years ago and whilst I could write it I just didn't like it as a language).

What I don't have any experience with is the vast array of frameworks that exist for writing graphical Windows applications.

I have a few ideas for Windows-based applications that I want to work through. I could do this is Perl/TCL/TK but I want something more "native" for a variety of reasons.

Through my current company I have access to Microsoft tools (and the licences to use them for "development") so I've decided to teach myself something new.

So, I've got Visual Studio 2008 installed. I fired it up, cliked "New Project" and then got absolutely confused by the variety of types of new project I could start.

Can someone please help me understand not only the fundemental differences but also any advice on what sort of things each type lends itself to?

Assuming I'm going down the C++ route (I know the language hence not choosing C# - unless this is actually more advisable...) I could use:

  • Windows Forms
  • MFC Application
  • Win32

I also know that away from Microsoft I could use wxWidgets. wxWidgets does appeal to me (cross platform, etc) but how does this compare to the various Microsoft options above? I also know Qt exists.

Many thanks,

Jeff G.

A: 

C# is the language of choice for Windows development, for me. I came from the same kind of background as you, and I found C# incredibly refreshing. I really love this language, and .NET is now my platform of choice. Plus, it's easy to keep in touch with your Unix roots via Mono development. Really, .NET is a great platform and you should explore it.

Also, when it comes to Visual Studio, you have to remember that the different projects basically only specify what kind of libraries are included, by default, and the build process. If you want to stay with a Unix style Makefile, you could do windows development with Mono.

Alex

Alex Fort
A: 

Windows Forms is by far the nicest of those. However, using windows forms from C++ will just confuse you more if you don't already know what you're doing, because then you're really using C++/CLI, which might just as well be a completely different language. Better off going C# if you want to go that route.

MFC is probably closest to what you're familiar with. But, again, Windows Forms is so much nicer.

Joel Coehoorn
A: 

I really would choose C# instead of C++. For Windows client apps, it can't be beat. For C/C++ dude like you, the syntax learning curve will be short. The difficulty will be learning the .NET framework, but that's the cost you'll have to incur one way or the other.

Once you select C#, just pick either Windows Forms or WPF Application. Both are client-side application types. If you pick WPF Application, you'll also have to learn XAML, which is a fairly new, but massively powerful, concept.

AngryHacker
A: 

I've tried doing some C++ programming in .Net (Windows Forms). And while it was possible it was certainly not a pleasurable experience, mostly because you have some extra keywords and such which differ from standarad C++. But if you're willing to learn some more C++ it's an option.

Myself I have started working on a project using C# which works really well. It's easy to learn to if you have a background in C++.

I wouldn't for the world touch the Win32 API ever again. It's really terrible!

Jonas
+2  A: 

It depends on how 'close to the metal' you want to be. Choose .Net/C#/Windows Forms/WPF if you want to quickly write Windows-only applications. Choose C++/MFC if you are determined to learn a platform that is not easy to use and has wards from 15 years of legacy code, but gives you infinite control over every little detail (to be clear: MFC is Windows-only, too).

MFC is a wrapper around the C win32 api, plus some extra goodies that package standard functionality. It helps a lot to know how the win32 api works. To learn this, I recommend 'Programming Windows' by Charles Petzold (called 'the Petzold' by oldtimers). You can also choose to start with MFC. Have a look at the many samples and tutorials that are included with Visual Studio and on sites like codeproject.com.

.Net / C# is a lot easier to use. It abstracts away a lot of the Win32 api, but it's still a wrapper - so for some things you'll need to 'drop down a level', like you used to have with Visual Basic. IMHO (and I'll probably get modded down for this), C# is the new Visual Basic except that it's not so ugly as a language and that it's statically typed. To be fair, it has some advantages too, like not requiring the strange VB runtime (but it does require .Net, so...)

Roel
Your comment on C# being the new Visual Basic is a little biased. Visual Basic.NET is a very mature language and does not require the "strange VB runtime" that you refer to. Language choices are just that, language choices. English is no better than Chinese. They all have their merits.
David Lambert
I can see how 'C# is the new Visual Basic' could be considered derogatory but I didn't mean it that way (ok maybe a bit ;) ). What I mean: C# is the new 'entry-level' way of programming Windows, even if it's a very capable language in itself. Also, VB.Net and the old VB are very different languages.
Roel
A: 

If you're just interested in writing graphical windows applications, just stick with "Windows Form Application". It will start you out with a blank windows form and a class that contains your main() method.

The "Console Application" project is probably the simplest, it just creates one class file for you with a main() and that's it.

The "Class Library" project has scaffolding and default build settings for creating a DLL.

There generally aren't any fundamental differences between the different kinds of projects. All they do is set up some default includes for you and generate some scaffolding code (e.g., a blank windows form) to get you started.

I do recommend learning C#. If you know Java it won't be too much of a leap for you. The initial version of C# was actually designed to be exactly like Java, but they have diverged a bit over the years.

jliszka
A: 

I think what I would suggest has a lot more to do with your objective. If you are looking to build your own application and want to get it to market quickly, and it has to be Windows, then I would go with C# WF as others have suggested.

If you are looking to make yourself more employable then I would go with C#/ASP.Net. This way you are learning C# but are also learning more about web developent, in general, and ASP.Net in particular. I think you will find that Windows Forms is a lot easier, comparatively, and not really be worth spending a lot of time on.

So if I were you I would build my application so that the majority of it is seperated from the interface. I would first learn how to make that code interact in ASP.Net, and then I would try it in Windows Forms. If you can do that you will learn a lot of really important skills for .Net framework development.

Flory
A: 

IMHO, wxWidgets is better than any of those. For example, I know of many people that converted their projects from MFC to wx. wxWidgets has all the MFC has (in early wx versions, a lot of classes were clones of MFC classes), and a lot more. It is not just a GUI library, but you have wrappers for all kinds of common tasks, like reading/writing XML files, Windows Registry, manipulation of various graphic types and image data, classes for conversion between character sets, etc. There are also a lot of add-on classes at wxCode website that can enhance your applications easily.

wxWidgets is also cross-platform, has full Unicode support, and only advances further. If you decide to give it a try, make sure you try wxFormBuilder for easy, WYSIWYG builder of user interface (dialogs, windows, ...).

Milan Babuškov