@Freddie1 - I just wanted to thank you, I was having trouble wrapping my head around why windows api looked so alien to me, and skimming through the posts here and that part where you showed PowerBASIC coding really helped. I'm not saying that I suddenly got a good grasp on the language, but I think I've got over some of the weirdness thanks to seeing that and getting your explanation.
Glad it helped newbieg. One thing psalm62 mentioned a couple times that I didn't address is that stdafx file oftentimes found in Visual Studio C++ projects.
When I use Visual Studio for C++ work I never let Visual Studio add any files to a project for me. I believe that stdafx or whatever it is comes from allowing Visual Studio to create a simple console or Windows program. What I do (and I know many other experienced coders) is set the properties of the project before I let Visual Studio create it, to an 'Empty Project'. That way, Visual Studio won't add any gunk/garbage to my project. So in other words, all it will do is set up some directories for me, and make some various files it needs to keep track of my project, i.e., *.vcp, vcw files, etc. But there will be no code files, i.e., *.h, *.cpp, *.rc, etc.
So once its done that, you need to either add a blank code file to the project of one kind or another, or paste a code file into the project directories from somewhere else, then use Visual Studio's facilities to add it to the project. Its my opinion that letting a development environment write my code for me is the antithesis of whatever virtue adheres to being a coder.
So all the code I've posted in this thread (except the PowerBASIC example) sholud compile 'as is' as part of any C++ project. And that goes for the rc file I posted early on. I don't even let Visual Studio write my resource scripts for me.