Which Win32 Tutorial is Better For C++?

Hi! I'm a intermediate C++ programmer and I just started learning the Win32 API. My question is just what it sounds like.

I have three links:
http://www.winprog.org/tutorial/start.html
http://msdn.microsoft.com/en-us/library/vstudio/bb384843.aspx
http://msdn.microsoft.com/en-us/library/ff381409(v=vs.85).aspx

That I acquired from researching. I did the first basic window application from each of them. The first link is obselete now but I just included it as one of the top tutorials I researched.

Between the last two, what the heck is the difference? I know there is a lot of difference in the code, but which tutorial is newer and more applicable? And which tutorial is better for the long run?

Just one of the differences (which I am confused about) is the return at the end of WinMain:
One returns 0.
The other returns something called (int) msg.wParam;

Thank you very much for your help!
Last edited on
This (int) msg.wParam; makes the exit code of the process to be the same as the one passed to PostQuitMessage() function; typically it is ignored for most purposes, so returning always 0 makes the code simpler.
Thank you very much. And after further analysis, the visual c++ win32 api tutorial was just showing how to use visual c++ (I think). The reason I say I think is because I don't know if there is more. The website is weird. When you collapse a menu, everything below it disappears.

Another question please:

What is this:
_In_opt
_In_
_Out_

They are coming before the typedefs so they are not types. I couldn't find definitions for these anywhere in the list of data types or data mappings.
I am very confused. I really REALLY appreciate the help! And I apologize for my ignorance if I ask a silly question with simple answers.
The best way to learn the win32 api is the exact same way you would learn any other library or api... That's to find a tutorial that is good enough to give you a basic understanding of the environment you're working in, then looking at the definitions of key functions and their parameters. A good way to keep yourself from being overwhelmed is to make a goal, as an example, you could make a windows based game that would require log in, save states, check boxes, radio buttons, etc etc, and learn how to do each thing individually as you move along.

As for a resource for the definitions of functions and parameters of the win32 api, it's always best to go to the source for information. In this case it would be Microsoft with MSDN.

The reason I don't refer you to a tutorial is because many tutorials are written by people who learned in a specific way and want to teach you the same way they learned. The reason this is bad is because c++ is an updated language, and many things become obsolete (Such as using GDI/+ etc). Also, it's better to learn for yourself, so that when you reach a problem, you are capable of solving it yourself (and not constantly looking back at tutorials).

TLDR; If you already have a good grasp on programming in general and the language that you're using, then it's best to learn about the functions, parameters, and limitations of the library/api. It's like learning the English language, if you already have a good basic grasp of the language, than a dictionary will always be more useful than a random book.
anonymousxyz wrote:
Hi! I'm a intermediate C++ programmer and I just started learning the Win32 API. My question is just what it sounds like.

I have three links:
http://www.winprog.org/tutorial/start.html
http://msdn.microsoft.com/en-us/library/vstudio/bb384843.aspx
http://msdn.microsoft.com/en-us/library/ff381409(v=vs.85).aspx

That I acquired from researching. I did the first basic window application from each of them. The first link is obselete now but I just included it as one of the top tutorials I researched.

Between the last two, what the heck is the difference? I know there is a lot of difference in the code, but which tutorial is newer and more applicable? And which tutorial is better for the long run?

Just one of the differences (which I am confused about) is the return at the end of WinMain:
One returns 0.
The other returns something called (int) msg.wParam;

Thank you very much for your help!


- I recommend that you use a book to help you learn Win32.

- I'm personally using Petzold's "programming windows" book to learn Win32 at the present time.
Topic archived. No new replies allowed.