What is “windows” header file ?
December 2, 2012 2 Comments
When I look back at my initial days of programming I can feel myself smiling over little, though unintentional but silly mistakes that I used to make and an even bigger smile comes when I think about the misconceptions I had in those days. No doubt they are all part of the learning experience. C++ was my first ever programming language that I learned. I was using Windows XP at that time so it was quite natural to use “windows.h” in my programs. You must be thinking “OK, Everything seems fine, so what is all this fuss about?” Well my friends the story has just begun
Here goes a short question answer session of my story .
Q: Why did I use windows.h ?
Ans: I used it for following two statements:
Q: What I thought about windows.h?
Ans: I considered it a Standard C++ Library Header File just like iostream, fstream and iomanip :)
Q: What did I know about windows.h?
Alright so the story ends here. Those of you who know the details must be smiling and may even be saying “It happens dude!” whereas the rest of you will certainly smile after completely reading this post.
The sole purpose of this post is to tell the beginners about “windows.h” and a little bit of details so that they do not have to go through all the trouble that I had to face.
WINDOWS.H is not a Standard C++ Library Header File which means that it does not come with C++ package (remember C++ is a language used for development of apps for various Operating Systems, not only Windows) instead it is a Windows-specific header file for the C/C++ programming language which contains declarations for all of the functions in the Windows API, all the common macros used by Windows programmers, and all the data types used by the various functions and subsystems. It defines a very large number of Windows specific functions that can be used in C/C++.
Don’t worry if you couldn’t understand some or most of what you read in the last paragraph because I’ll be explaining things shortly. First of all remember that Windows itself is a piece of software what we call an Operating System. For those who don’t know the details, it’s the job of an operating system to manage all the activity performed by hardware present on your computer. So whenever we run an application, actually it is running on to the operating system, telling the operating system what to do and how to do it in order to get specific results. In order for things to work smoothly a bunch of small programs have been collected together into different various files by Microsoft. Each of these files contains basic commands to perform a task, individually none of them would make a complete software but collectively they are amazing, so these pieces of codes were called Win APIs (Application Programming Interface) where ‘Win’ obviously specifies that this interface is for Windows applications only.
So by now you should be able to understand that in order to use specific features of Windows we will have to use some predefined lines of code (API’s) in a standard way. Remember the purpose of this post is not to teach you windows programming but to prepare you mentally for some basics of windows programming. I will soon be posting about some contents of “windows.h” file and a general guideline along with some good tutorials for programmers so stay in touch. Till then happy programming