[Visual C++] Windows Programming Tutorials?

x BlueRobot

Administrator
Staff member
Joined
May 7, 2013
Posts
10,400
Those anyone know where to find any good Windows programming tutorials for C++? I mean write Visual applications, the MSDN documentation is okay, but doesn't really explain much and how to implement the code properly.
 
Well, I have no idea how far you've gone by know with your C++ knowledge, but if you plan on starting from the beginning, these tutorials provide great explanation of basic stuff like, if statements, loops, etc.
C++ Tutorial - Learn C++ - Cprogramming.com

When programming, unless you aim to work with it, you don't really have to learn the language all out before making your first app, just continiue on until you hit a wall, google it.
If google don't have answers, ask some friends or make a thread about it. Also, you will have alot of advantage knowing a low level language while working with C/C++ native.

Thing with programming is that, the more you read, the more you know, it's as simple as that, as long as you understand what you are reading.
 
You'll need to understand much of the Win32 API and how to use graphics and manage Windows Messages in a message loop. Going with custom GUI graphics without any framework like Qt can be a bit daunting at first, and if you don't have some kind of model to manage your GUI and handle events properly for you, it can degrade performance and even turn into a nightmare if you have to manually manage more of the GUI portion than necessary in parts of your code that are meant to actually perform tasks that make your program useful to the end-user.
 
This thread is two years old if you haven't noticed.
 
This thread is two years old if you haven't noticed.

An old thread doesn't mean that more can't be contributed to the topic. IMO it's much better than having a new thread with information on topic with an existing thread than to have it all consolidated within a single thread so that people don't have to search the entire forum just to find relevant information.
 
No, I'm not saying that it can't be contributed more.
I'm just pointing it out in case you missed it.
 
No, I'm not saying that it can't be contributed more.
I'm just pointing it out in case you missed it.

Why though? It's only less than a month old, but there were no previous replies either. I think it's fine :)

Technically a month and two years, but close enough ;)

I think it's fine though - good content is good content. If it's triggered an interesting discussion as this precisely has, what does it really matter if the original post was a couple of years old. I think that our focus should be on generating good content, not worrying too much about the how :)
 
No, I'm not saying that it can't be contributed more.
I'm just pointing it out in case you missed it.

Why though? It's only less than a month old, but there were no previous replies either. I think it's fine :)

Technically a month and two years, but close enough ;)

I think it's fine though - good content is good content. If it's triggered an interesting discussion as this precisely has, what does it really matter if the original post was a couple of years old. I think that our focus should be on generating good content, not worrying too much about the how :)

I suppose I'm still living in 2013. :)

(I quickly glanced at the month, forgot about the year. I wonder if I'm already getting old, or if I was just really tired. :grin1:)
 
Sorry for reviving a thread I said not to do earlier (hypocritical, yes).
Do you have any recommendations for learning the Win32 API?

I've started with a bit of Win32 programming (A blank window), but I've hit a dead end with where to go next.
 
Charles Petzold's Programming Windows, 5th Edition, and Kernighan-Richie "The C Programming Language", 2nd edition, are a must.
By the way, I'm not a programmer...
 
Charles Petzold's Programming Windows, 5th Edition, and Kernighan-Richie "The C Programming Language", 2nd edition, are a must.
By the way, I'm not a programmer...

The first of those books was published in 1998, the second in 1988. Irrespective of how good they are (in fact the Kernighan-Richie book is very good), they're not exactly modern. Computers and computer programming has moved on hugely since the times of Windows 2.0/Windows 98. I would stress to all the vital importance of learning C++ especially from a book which teaches the most up to date and modern programming techniques (which is not quite the same as being published this year...there are a lot of bad books out there). C++ hasn't changed all that much in recent years but the way we use it really has.

For book recommendations see here - c++ faq - The Definitive C++ Book Guide and List - Stack Overflow

Also, Jared, what are you trying to program?
A .net style GUI? How good is your C#?
A .net style GUI coded without using .net?
A 2D platformer game? Full 3D game?
A composite window with standard UI elements but also a 3D graphics drawing area (like a chemistry app which shows details of a molecule and then a 3D rotating graphic of its structure).
 
Yes, Richard, but the windows api didn't change in the meanwhile: always c and Windows api (written in c).
Then, yes, one can also use c++ and c# to write programs, but then one'll need to provide also their vc++ redistributables and his users will need different versions of .net frameworks and without them one'll start to get errors.
Some programs written in the old manner still works instead, without .net framework and without redistributables.

Therefore one'll need to learn c, c++ (mfc, atl, etc), windows api, c#, and maybe one'll give up.
Whereas when one programs in c with windows api, one'll need only those two; one can always learn c++ (mfc, atl, etc) and c# later (they are still using windows api).
 
Last edited:
Actually the WinAPI has changed over the years. Not nearly as much as the language but it has changed.

Wikipedia said:
Over the years, various changes and additions were made to Windows systems, and the Windows API changed and grew to reflect this. The Windows API for Windows 1.0 supported fewer than 450 function calls, whereas modern versions of the Windows API support thousands.

Wikipedia said:
One of the largest changes to the Windows API was the transition from Win16 (shipped in Windows 3.1 and older) to Win32 (Windows NT and Windows 95 and up).

Wikipedia said:
Almost every new version of Microsoft Windows has introduced its own additions and changes to the Windows API.

Even a cursory read of Windows API - Wikipedia, the free encyclopedia would have shown you that you are wrong.


Now look here - a hello world application which is hundreds of lines long. Written in C and an ancient version of WinAPI.

Petzold Book Blog - The Infamous Windows Hello World Program

We've moved on since then. As computers have got more and more complex, Microsoft and other API developers have been creating more and more wrappers, functions or language extensions to simplify everyday or routine coding tasks. It is naïve and foolish to think that shunning 20 years of computer development and returning to the 1990s is a good way forward.


My precise point is that - at this early stage - building up from a basis of C and trying to learn ancient techniques, followed by repeatedly re-learning new ones as you progress up through the years, breaking old habits and trying to forget things C programmers did we no longer consider best practice, is an exceptionally bad way to trying to learn to program.

Instead buy a modern C++ programming book, which teaches the latest and most up to date techniques, and jump straight in there. Don't start 20 years ago and build on a shoddy foundation of C. Go straight to modern C++.


Your talk about redistributables is also again wrong. Microsoft keep building the latest ones directly into Windows OOBE. Even as far back as Windows Vista - dating from the 2005 era - has .net Framework 2.0 and Visual C++ Redistributable 2005. So you don't even have to bundle anything with your installer to make your programs work.


Almost every piece of advice you have given here is wrong. Please consider carefully whether or not you have done enough WinAPI programming to talk knowledgeable in this area.
 
Yes, Richard, I wrote it in my first reply that I'm not a programmer. ;)
But when I was interested (to search the best programming language to learn), trying to do simple things, I've been lost looking at c, then c++, then mfc (that should have simplified things), then atl, then (can't remember but there is another framework for c++), to then learn there is c# (that should have simplified things), and why not d programming language, and so forth.
Now (well, some years ago when windows 8 came out) Petzold says it's the turn of c# and XAML (programming windows 6th edition).
But if one wants to program in windows, he'll discover windows API are needed with all those languages/frameworks. Even when they are a bit hidden in the framework.
I.e., the point, I tried to reach, is one needs to learn windows api (to learn the current windows api is obviously better, I didn't want to say one should learn outdated windows api - in 5th edition by the way there are for sure outdated api, but I think, not sure, they are not changed too much - i.e., Microsoft still supports old api, otherwise they could have broken every previous windows OS).
 
Last edited:
Actually the WinAPI has changed over the years. Not nearly as much as the language but it has changed.

Wikipedia said:
Over the years, various changes and additions were made to Windows systems, and the Windows API changed and grew to reflect this. The Windows API for Windows 1.0 supported fewer than 450 function calls, whereas modern versions of the Windows API support thousands.

Wikipedia said:
One of the largest changes to the Windows API was the transition from Win16 (shipped in Windows 3.1 and older) to Win32 (Windows NT and Windows 95 and up).

Wikipedia said:
Almost every new version of Microsoft Windows has introduced its own additions and changes to the Windows API.

Even a cursory read of Windows API - Wikipedia, the free encyclopedia would have shown you that you are wrong.


Now look here - a hello world application which is hundreds of lines long. Written in C and an ancient version of WinAPI.

Petzold Book Blog - The Infamous Windows Hello World Program

We've moved on since then. As computers have got more and more complex, Microsoft and other API developers have been creating more and more wrappers, functions or language extensions to simplify everyday or routine coding tasks. It is naïve and foolish to think that shunning 20 years of computer development and returning to the 1990s is a good way forward.


My precise point is that - at this early stage - building up from a basis of C and trying to learn ancient techniques, followed by repeatedly re-learning new ones as you progress up through the years, breaking old habits and trying to forget things C programmers did we no longer consider best practice, is an exceptionally bad way to trying to learn to program.

Instead buy a modern C++ programming book, which teaches the latest and most up to date techniques, and jump straight in there. Don't start 20 years ago and build on a shoddy foundation of C. Go straight to modern C++.


Your talk about redistributables is also again wrong. Microsoft keep building the latest ones directly into Windows OOBE. Even as far back as Windows Vista - dating from the 2005 era - has .net Framework 2.0 and Visual C++ Redistributable 2005. So you don't even have to bundle anything with your installer to make your programs work.


Almost every piece of advice you have given here is wrong. Please consider carefully whether or not you have done enough WinAPI programming to talk knowledgeable in this area.

Yes but the basis of the Windows API is still the same. A lot of the same conventions are used in newer parts of the Windows API even years later. IMO, it takes more getting used to what the P, C, L, W, T means in things like PVOID, PCSTR, and such, among other common standards throughout the Windows API than it does getting used to C itself. These things aren't going to change but you still have to know what they mean when dealing with the Windows API in order to fully understand what you're doing, and this isn't going to change anytime soon because things that deviate from the original coding conventions they've used would make it harder for Microsoft to maintain. You can learn all the C in the world but you'll still be reading MSDN article after MSDN article to learn how to use the Windows API properly without doing something bad.

As for learning the Windows API, any book on C++ is not going to help at all... The Windows API doesn't consist of functions that use templates, smart pointers, vectors, references, etc... He'll want to start off with a basic book on C, then grab a book dedicated to the Windows API itself to learn more about its structure.

The only thing with learning from older books is that you may run into things like 'void main' and deprecated functions that have been superseded by newer functions and entire API's. The rest of the information if you can get past that is still going to be at least somewhat helpful for getting a foot in the door... But anyone with enough Windows API experience might even be as bold as to say that it's almost like a separate language that you have to learn on the side apart from C, and unless you coincidentally use all the same conventions that Microsoft uses, it's probably still going to look unfamiliar to you even as an experienced C programmer.
 
Last edited:

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top