I need help learning Win32...actually, I don't know whether I should be learning it yet. So far I know all the basic stuff (the language, that's it). Should I be jumping straight to Win32 programming or should is there an intermediate step? Also, if you think I should be learning Win32, what is the best place to learn it?
You shouldn't use the WinAPI (assuming that's what you mean) directly if it can be avoided.
Rather, use libraries that deal with the platform dependant stuff for you.
@Athar
not to be frank but, Why the hell not? If you use the API calls directly it's inevitable going to produce faster code, which is ALWAYS a good thing.
lol I was already learning it from the MSDN but ty anyway...by the way, how are you supposed to remember all of the functions and parameters just to create one lousy window?
If you use the API calls directly it's inevitable going to produce faster code, which is ALWAYS a good thing.
No, it won't. The libraries will eventually call WinAPI functions to get the job done. The overhead is rarely more than a function call, which obviously doesn't matter.
Many WinAPI functions are a pain to use and libraries will do most of the work for you, greatly simplifying the process. What's more, it will run on many different systems instead of just Windows.
But even your turn of phrase suggests that it will be slower "...will eventually call...". Unnecessary layers of abstraction will slow the code, maybe not by much but still.
The overhead is rarely more than a function call, which obviously doesn't matter.
How is it obvious that the overhead doesn't matter without knowing the application?
There's considerations other than performance when using libraries. Introducing dependencies into a project is always a pain. For one, you open up the possibility for bugs in code you don't know.
If you're using the library to improve portability or to reuse a known implementation, it's one thing, but to use a library as just a wrapper for other functions...
I'll just go ahead and claim that even if your program will have 10,000 users, the accumulated amount of the CPU time saved in the next fifty years by callling the API functions directly will still be lower than the additional time you spent on writing the code.
It hardly matters that your ReadFile call to read a small chunk of a file, which takes maybe 150 million CPU cycles is three cycles faster than the function your library provides.
However, a library can provide you a clean and easy to use C++ interface to all the relevant WinAPI C functions.
How is it obvious that the overhead doesn't matter without knowing the application?
Because there are very few WinAPI functions that take very little time to complete (i.e. less than a few thousand CPU cycles).
Compared to the execution time of the functions themselves the overhead is negligible.
Edit: I'm not sure if we're talking about the same things.
Things that you should use libraries for are file and network related things, the GUI, image processing... these are common tasks and well-known libraries are very well tested.
If you have to do very exotic things, you'll have to use WinAPI calls anyway, simply because there are no libraries for that task or only half-baked ones. But the good thing about "exotic things" is that you'll rarely need them.
I am learning C++ in the context of game programming. Memory management and running speed are essential for game programming. In a videogame, communications between objects in the program must be airtight, and all internal calculations must take less than 1/30th of a second. The new image must be re-rendered 30 times per second, and if the computer can't run it fast enough, you get crappy FPS, and you go get a new game, cuz the one you just played...sucked ass.
EDIT: But I still don't know whether using Windows APIs would make any difference at all...
If you're going into gamedev, I'd learn Something like OpenGL or Direct X instead of the WinAPI. Not only will it be a tad faster to learn (assuming OpenGL...at least I found it easier to learn than anything windows related) but it'll be more useful to you for what your doing.
I have to use Win32 API all day for most everything except GUIs (which we use MFC instead). To be honestly, when I need something, I look at MSDN basically, but if I feel stuck and there is this site:
http://www.tenouk.com/cnwin32tutorials.html
The've sort of made a "more human readable" version out of MSDN. I usually write programs for Windows to interface with hardware or to process text or binary files, but as said here, if there is library that wraps the API, it would be better use this library if you are dealing with something complex like USB interfacing or PCSC.
In time, if someone recomends you that WinForge's tutorial, be aware that is focused on GUIs. If you are required to code GUIs using the API directly there are other better references:
http://www.relisoft.com/Win32/index.htm ( They teach how to wrap Win API classes using C++)
http://www.functionx.com (this is excellent for MFC too )
http://zetcode.com/tutorials/winapi/
(The first one is rather advanced while the other two are teaching the basics)
The tenouk site just teaches you the actual API rather than GUIs.
My current "book of dreams" is Windows System Programming by Jonhson M Hart, which I will buy whenever I can afford it.
Thanks for the advice. BTW, if you are going into game programming, there is a book you ABSOLUTELY MUST READ!!
Game Coding Complete (third edition) by Mike "Mr. Mike" McShaffrey.
It explains all of the concepts behind game design and teaches you to organize your program in an effective and efficient way. It basically tells you everything you need except the code for your game. It includes some pretty good code examples (But only in places where they are really necessary). It's also pretty cheap for 859 pages: I got it for 30$ on Amazon.
EDIT: It is definitely a super-advanced book, so it's probably best for experienced programmers (Not like me, I just bought it for the heck of learning game coding).