Sign in to follow this  
BringBackFuturama

MFC, Win32, .NET...Confusion!

Recommended Posts

Okay, so after you guys answered my question about OpenGL and such yesterday, I decided to get a book on Windows Programming. Ugh..apparently they change the format often. I'm getting books form the early 90's here when I looked for Win32, and I'll get newer books that are about MFC, but I thought that MFC was updated. I'm lost...what is the "new" thing that I need to use to keep up? Whatever is going to work with Vista is preferable, unless that's different from XP.

Share this post


Link to post
Share on other sites
Quote:
Original post by Enselic
You want to write applications for windows?

.NET

Win32 and MFC is just 'no'.


Okay. Do you have any reccomendations of a good book? I'm having trouble finding a .NET C++ book, they all seem to be using C#, and I'd rather not learn that language right now.

Share this post


Link to post
Share on other sites
If your going to use .NET, you will probably want to learn C#. Using C++ and .NET is ugly at best. I also did not want to learn C#, but it is very easy to learn, has a free compiler from Microsoft, and makes it extremely easy to create Windows UI programs.

Share this post


Link to post
Share on other sites
There will always be Win32, but the current technology that MS would like you to use is .NET and when Vista ships it will be WinFX (which is kind of the next version of .NET).

So .NET would be a good place to start. One of the best introductions to .NET and the C# programming language is Andrew Troelsen's "Pro C# 2005 and the .NET 2.0 Platform" from APress.

Share this post


Link to post
Share on other sites
Quote:
Original post by azherdev
I thought WinFX was the visual portion only. It will still be .NET but instead of GDI+ you had WinFX.


No, WinFX is the managed API. The GUI part of that is Windows Presentation Foundation (which is built on top of DirectX).

Share this post


Link to post
Share on other sites
Quote:
Original post by ussnewjersey4
If your going to use .NET, you will probably want to learn C#. Using C++ and .NET is ugly at best. I also did not want to learn C#, but it is very easy to learn, has a free compiler from Microsoft, and makes it extremely easy to create Windows UI programs.


Ah screw it. I'm not learning a new langauge just so the Microsoft can be happy with itself. Maybe I'll pick up VB.NET later, but I've already learned C, C++ and Python and I want to actually use them.

Share this post


Link to post
Share on other sites
Quote:
Original post by BringBackFuturama
Quote:
Original post by ussnewjersey4
If your going to use .NET, you will probably want to learn C#. Using C++ and .NET is ugly at best. I also did not want to learn C#, but it is very easy to learn, has a free compiler from Microsoft, and makes it extremely easy to create Windows UI programs.


Ah screw it. I'm not learning a new langauge just so the Microsoft can be happy with itself. Maybe I'll pick up VB.NET later, but I've already learned C, C++ and Python and I want to actually use them.


Don't be discouraged. C++ with .NET WAS very bad with .NET 1.0 and 1.1. The syntax was extremely verbose. But they completely redesigned the language extensions for C++ with VS 2005 (.NET 2.0), and its much cleaner and concise. I don't think there should be anything wrong with you writing a C++ application for .NET with VS 2005.

Share this post


Link to post
Share on other sites
Quote:
Original post by nimrand
Quote:
Original post by BringBackFuturama
Quote:
Original post by ussnewjersey4
If your going to use .NET, you will probably want to learn C#. Using C++ and .NET is ugly at best. I also did not want to learn C#, but it is very easy to learn, has a free compiler from Microsoft, and makes it extremely easy to create Windows UI programs.


Ah screw it. I'm not learning a new langauge just so the Microsoft can be happy with itself. Maybe I'll pick up VB.NET later, but I've already learned C, C++ and Python and I want to actually use them.


Don't be discouraged. C++ with .NET WAS very bad with .NET 1.0 and 1.1. The syntax was extremely verbose. But they completely redesigned the language extensions for C++ with VS 2005 (.NET 2.0), and its much cleaner and concise. I don't think there should be anything wrong with you writing a C++ application for .NET with VS 2005.


It's not the syntax, it's the fact that there's hardly any information on it. I found one book on Amazon called "Pro Visual C++/CLI and the .NET 2.0 Platform" that sounds pretty good, but it's a $70 book...yikes.

Share this post


Link to post
Share on other sites
I would recommend you learn the BASICS of Win32 API if you want to leverage your C++ knowledge. The thing with a little core Win32 knowledge is, it will help you assimilate all the other systems that are interacting, so when something in OpenGL, or SDL, or DirectX or (insert API or framework here) isn't working with your other code as expected you will have a clue how the messages are being passed around the app to start with, and might possibly be able to see something wrong. I'm not saying you NEED to know Win32, I'm just saying its worth a little of your time.

For game logic I use pure C++ as much as possible (cross-platform even usually) - with libraries like OpenGL, OpenAL and whetever else I feel like trying (I'm going to look into OGRE soon). But for windows standard GUI programs, .NET is the way to go ... it is basically like they took an SOS pad to MFC and scrubbed off all the rust, they placed it in a nice little java-like package. The C# syntax is definately the cleanest and best of all the .NET languages though, so much so that even as primarily a C++ programmer I write better GUIs quicker in C# than C++.

I also use ruby.

Share this post


Link to post
Share on other sites
Petzold wrote the definite book on Programming Windows but his latest version uses C# or vb.net so you'll probably want to stick with the 5th edition:
" There are so many ways to write Windows programs these days. There's the API, there's MFC, and now there's .NET and Windows Forms, and in a couple years Avalon is coming out. What should I use?
A. I can't answer that question for you. The programming interface you chose must be based on many factors, including the programming resources you have, and your target audience.

However, it is very clear that the world needs to be moving in the direction of managed code, and that's where the world seems to be going. Exploring Microsoft .NET now (including learning C# and Windows Forms) puts you in an excellent position to take on WinFX (also known as Avalon) when it becomes available.
"
http://www.charlespetzold.com/faq.html

Share this post


Link to post
Share on other sites
Quote:
Original post by daviangel
Petzold wrote the definite book on Programming Windows but his latest version uses C# or vb.net so you'll probably want to stick with the 5th edition:
" There are so many ways to write Windows programs these days. There's the API, there's MFC, and now there's .NET and Windows Forms, and in a couple years Avalon is coming out. What should I use?
A. I can't answer that question for you. The programming interface you chose must be based on many factors, including the programming resources you have, and your target audience.

However, it is very clear that the world needs to be moving in the direction of managed code, and that's where the world seems to be going. Exploring Microsoft .NET now (including learning C# and Windows Forms) puts you in an excellent position to take on WinFX (also known as Avalon) when it becomes available.
"
http://www.charlespetzold.com/faq.html


That's a good quote. Of course if you're doing games and/or graphics programming managed code might not always be an option or even desirable.

Share this post


Link to post
Share on other sites
Though you said in your other thread that you'd prefer to have a book in front of you, but I'm going to suggest again you start with trying an online "Hello World" tutorial.

That aside...
Programming Windows, Fifth Edition. Charles Petzold
or if you're on a budget...
one that's really old and used but the basics are still the same

I'd suggest, learning how to get a window up and respond to messages so that you can get keyboard and mouse input. Then, take a stab at the drawing stuff. It may get completly replaced by the more advanced OpenGl or DirectX stuff, but it's still good to learn and you could certainly make a beginner game out of it.

Now, those books will also have all kinds of stuff on how to use the various standard windows controls and dialog boxes. In my opinion, this is where the divergences to MFC and .Net start to become relevant as getting a lot of basic functionality using the basic Win32 stuff can get pretty tedious. I wouldn't use the Win32 API to write an app with a bunch of dialog boxes, but using it to create settings options for my pacman clone didn't bother me at all. But if you wanted to use controls more complex than getting text input and using buttons, you'd probably be doing yourself a favor by learning .Net. And of course, there's more to .Net than just dialog controls.

Of course, all the while you're learning this stuff, read the book or tutorial to answer questions like, what's a callback function.

Share this post


Link to post
Share on other sites
Quote:
Original post by kseh
Though you said in your other thread that you'd prefer to have a book in front of you, but I'm going to suggest again you start with trying an online "Hello World" tutorial.

That aside...
Programming Windows, Fifth Edition. Charles Petzold
or if you're on a budget...
one that's really old and used but the basics are still the same

I'd suggest, learning how to get a window up and respond to messages so that you can get keyboard and mouse input. Then, take a stab at the drawing stuff. It may get completly replaced by the more advanced OpenGl or DirectX stuff, but it's still good to learn and you could certainly make a beginner game out of it.

Now, those books will also have all kinds of stuff on how to use the various standard windows controls and dialog boxes. In my opinion, this is where the divergences to MFC and .Net start to become relevant as getting a lot of basic functionality using the basic Win32 stuff can get pretty tedious. I wouldn't use the Win32 API to write an app with a bunch of dialog boxes, but using it to create settings options for my pacman clone didn't bother me at all. But if you wanted to use controls more complex than getting text input and using buttons, you'd probably be doing yourself a favor by learning .Net. And of course, there's more to .Net than just dialog controls.

Of course, all the while you're learning this stuff, read the book or tutorial to answer questions like, what's a callback function.


I looked at that book...but it just seems a bit too dated. I was looking at .NET and C#, and I really don't like C#. It's just a bunch of levels of classes. I prefer procedural-programming like C over OOP. I finally did find a book on C++ and .NET, but it better work pretty well since it costs so much:

http://www.amazon.com/gp/product/1590596404/sr=8-1/qid=1147992167/ref=pd_bbs_1/002-4711460-1700822?%5Fencoding=UTF8

Share this post


Link to post
Share on other sites
Actually this is the best book on windows programming out there right now but once again it uses C# not c or c++
http://www.amazon.com/gp/product/1932394656/qid=1148037354/sr=1-1/ref=sr_1_1/104-7670837-8469514?s=books&v=glance&n=283155

Share this post


Link to post
Share on other sites
Quote:
Original post by daviangel
Actually this is the best book on windows programming out there right now but once again it uses C# not c or c++
http://www.amazon.com/gp/product/1932394656/qid=1148037354/sr=1-1/ref=sr_1_1/104-7670837-8469514?s=books&v=glance&n=283155


Well considering WinForms is already kind of a legacy technology I wouldn't bother with it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this