1. As far as I know, by using the Windows API it allows us to use the operating systems functions in our programming, am i correct?
2. How exactly does the window.h header file relate to this, wikipedia says it "contains declarations for all of the functions in the Windows API", as far as I can make out the windows.h header file basically IS the Windows API as it contains the functions, am i correct?
windows.h contains declarations for most of functions in windows API, but not all. It is just a header file after all, to compile/link a windows program still need import library for used functions and corresponding dll's be present at runtime.
So in other words, when you set up your IDE to create a Windows program where you are making calls to various Api functions (some GUI related, others perhaps not), your environment will be set up by the IDE to link statically with kernel32.dll, user32.dll, gdi32.dll, etc. Those files and files they in turn access are the operating system, as it were.
So, when i go to create a new project in Visual Studio and choose "windows application", the IDE will automatically link my project to the dll files which contain the function declarations of the Windows API, which actually form the Windows API, right or wrong?
Im still abit confused, does the Windows API dll files provide windows functions, or is it the window.h file which provides windows functions?
Ah, so the dll files contain the actual function declarations, but as they are in binary format we need a way of translating this... the windows.h file? that doesnt seem right :S
The DLL files do not contain any declarations, in fact, the function identifiers are purposefully mangled ( http://en.wikipedia.org/wiki/Name_mangling ). You also seem to be mixing the terms "Declaration" and "Definition". ( http://cboard.cprogramming.com/c-programming/122712-variable-declaration-vs-definition.html ) Header files contain only declarations - (and the occasional inline definition).
The mechanics of the linking process is (potentially) beyond the scope of this site, however.
*And incidentally beyond the scope of my knowledge as well.
SO, the windows.h file contains the declarations and the dll files contain the definitions.
Could you explain to me why this is done in two different files, why not just have the definition and declaration in one file, wouldnt it be less hassle?
Well, it's a combination of a lot of reasons really.
1) Separating interface from implementation is what makes up the black-box concept. You shouldn't need to know the inner implementation details in order to use the code.
2) Compilation times are greatly reduced, as constructs using parts of a header do not need to be recompiled for changes made to the implementation.
3) Security - I doubt that Microsoft would want to release the implementation details of their proprietary files for their competitors to pick apart. Not everyone lives in open source hippie land ( zing - sorry :P ).
There are a lot of other reasons as well, Google would be able to tell you more.
Could you explain to me why this is done in two different files, why not just have the definition and declaration in one file, wouldnt it be less hassle?
The same reason you would separate your own implementations and declarations into header and source files.