PDA

View Full Version : wich book to start windows programming??



kantze
09-04-2007, 08:21 AM
Hello , I want to start learning Windows Programming.

I heard there are 3 ways of creating windowed programs:
1. Win32 API
2. using MFC classes
3. with CLI C++ or .NET or whatever it is called..

As a starter,
I chose the first way because it begins from the basics and it deepens more than the others.

I borrowed the so-called book "Programming Windows" Charles Petzold.

Can you tell me if I chose the right way? What else would you suggest me to do ?

p.s. this book is really huge and i don't want to learn so many things I won't use later...

matsp
09-04-2007, 08:28 AM
Aside from the three choices you show, there are various "third party" libraries that allow you to develop not only Windows applications, but also apps that work on for example Linux. wxWidgets is one of those.

MFC is relatively easy to get an application going with. The direct Win32 API is a bit more "complicated", but if you do understand it, it's going to help with any and all other layers (because somewhere, someway, that's essentially the only way to actually do anything).

As to books, I've heard good things about the Charles Petzold books, so it's certainly not a bad thing.

When it comes to "learning more than you need", it very much depends on what you want to do - but graphical user interface applications are ALWAYS going to be somewhat of a complicated project [unless the application is REALLY simple].

--
Mats

kantze
09-04-2007, 08:38 AM
OK, thanks for your answer, one last thing to clarify:

Is it like what it is said " learn first C to understand basic stuff ( pointers etc) and the continue with c++"
so here, learn win32 api and then go with mfc or whatever?

CornedBee
09-04-2007, 08:44 AM
Yes, except that unlike the C-before-C++ advice, this one is actually a good idea.

kantze
09-04-2007, 08:52 AM
Yes, except that unlike the C-before-C++ advice, this one is actually a good idea.

Heh, I've no more hesitations now!

@ CornedBee : Your laconic phrase totally convinced me! ;)

matsp
09-04-2007, 08:53 AM
Yes, except that unlike the C-before-C++ advice, this one is actually a good idea.


I agree with this completely and the above to some extent. C++ is a different language than C - it can be used in a very similar way, but for "correct use" of C++, it should be considered a completely different language.

When it comes to "learn Win32 API first, then MFC", there's some truth in that - if you can write code for Win32, then MFC is really trivial for most things, both because it does the same things as the API, and because the MFC "simplifies" things - there are many things that are just a single call in MFC, whilst half a dozen calls in Win32 API.

The problem comes when the MFC framework isn't doing enough/the-right-thing for what you want your application to do...

--
Mats

MacGyver
09-04-2007, 09:26 AM
Not to get into another debate with C vs C++, but I think it's easier to move from C to C++ than it is the other way around. Regardless, C++ is a separate language, although it allows you to write everything in a C-style format.

CornedBee
09-04-2007, 10:33 AM
I think it's easier to move from C to C++ than it is the other way around.

I would disagree, simply because of the number of features C++ has that C doesn't, but that's not the point. The point is that learning C in order to learn C++ is nonsense. If you want to learn C++, learn C++.

MacGyver
09-04-2007, 10:49 AM
I would disagree, simply because of the number of features C++ has that C doesn't, but that's not the point.

That was my point. If you're a C programmer writing a C++ program, the classes that make up the C++ library are quite safer and easier to use than many C counterparts.

Also, as a last resort, if you get stuck with something, you can always write it out the C way, so you're not always fully stuck (even if that isn't advisable).

Going from C++ to C, you end up realizing that all kinds of nice features don't exist, and you're stuck doing relatively simple things in a very round-about and low level manner than what you may be used to. By the end of the day, if you've grown accustomed to C++ features, you'll probably stick with them and discard C, depending upon your end goals.


The point is that learning C in order to learn C++ is nonsense. If you want to learn C++, learn C++.

While you'll learn to do things properly in a C++ sense if you learn C++ first, you'll have a lot of confusion as to why C++ provides backwards compatability with many C features.... ie. Why do some functions need C style strings? etc. etc..

But overall, your code should be safer from a C++ perspective. Outside of C vs C++, I think learning C leads you to a closer view of machine architecture and how things run more closer to reality. If you wish to learn assembly at one point, I would think you're better off learning C. C++ uses a lot of C tricks behind the scenes to get stuff done, but it's a little harder to see what's going on if you're not well grounded in the basics.

If you just want to write programs in C++ because you like the language, go for it. :)

After all, what languages you learn depends upon your end goals. :)

indigo0086
09-04-2007, 10:50 AM
I never saw the difference going to C from C++. You go through a few more motions to do the same thing, a lot of pointer passing, but it's not drastically different. It just gets me in the mindset to use C++ techniques while using a C library.

novacain
09-04-2007, 11:10 PM
Hello , I want to start learning Windows Programming.

I heard there are 3 ways of creating windowed programs:
1. Win32 API
2. using MFC classes
3. with CLI C++ or .NET or whatever it is called..

As a starter,
I chose the first way because it begins from the basics and it deepens more than the others.

I borrowed the so-called book "Programming Windows" Charles Petzold.

Can you tell me if I chose the right way? What else would you suggest me to do ?

p.s. this book is really huge and i don't want to learn so many things I won't use later...

You can also create Windows apps with VB6.
VB.NET and C# are covered under .NET.

Petzoid is a good start into WIN32. MSDN is vital as well (though much harder to use...).

I would also get a copy of MS Visual Studio. Is the only IDE ('compiler') I have used professionally. Knowing how to fully use your IDE is an important/vital skill.

If I was starting now, I would start learning C# for a career or C++ WIN32 then MFC for a hobby. Depends on what you want to program

I learnt WIN32, then MFC (then VB, C# ect). This has allowed me to understand the advantages of the various APIs/Frameworks and choose the right tool for the job.

My personal choice for apps is a combo of WIN32 C++ / MFC. MFC for the quick development time and WIN32 for the bits MFC can't reach.