This is a tutorial, that will introduce you to the programming with the pure Windows API. No MFC. (Microsoft Foundation Classes is a widely used C++ library for developing C++ aplications on Windows.) The programming language is C. Even if you are not a C programmer, it might be interesting for you to go through this tutorial. It will give you an insight what happens under the hood, when you programm in a higher level language. Programming in C using winapi is difficult and tedious. You must do much more work. It is much more error prone. On the other hand, you have more control over the application coding and you learn a lot. This tutorial has been created and tested on Windows XP. The examples have been built on Visual C++ 2005 Express Edition.
Windows is the most widely used operating system on personal computers. The winapi is the source code interface that is used to create windows applications. In order to create windows applications, we must download the platform sdk. The sdk (software development kit) contains header files, libraries, samples, documentation and tools that use the winapi to develop applications. The windows api is created for C and C++ programming languages. It is the most direct way to create windows applications.
The windows API has four basic components.

The base services provide access to the fundamentsl resources on Windows. These include file systems, devices, processes, threads, registry or error handling. The GDI (Graphics Device Interface) is an interface for working with graphics. It is used to interact with graphic devices such as monitor, printer or a file. The User Interface provides funcionality to create windows and controls. The Network services provide access to the network capabilities of the Windows OS.
There were times, when developers could choose between C and Assembler. Nowadays, there is a plethora of programming languages. C, C++, C#, Java, Python, Visual Basic just to name a few. Today the problem is to choose the right language for your job. People use Java, C#, Visual Basic to create business applications. For resource intensive applications like graphics programs or games, the C++ language is the answer. The C language has not been completely superceded by other programming languages. People still use assembler! If you would like to develop a smaller system program, the C language might be the best choice.
These days multiplatform programming is very popular. There are several libraries, that enable programmers to create applications that will run on Windows, Linux, BSD and Mac OS. These are well known libraries: Qt, Swing or wxWidgets.
C and C++ languages can use Windows API directly. Other languages use intermidiary libraries. These libraries have been created in C or C++. So other languages call the Windows API indirectly. There is one exception. It is the Java SWING library. It is a multiplatform library used to create Java GUI applications. SWING does not use the Windows API. It draws all the windows, controls etc. itself.
Visual C++ has been one of the best pieces of software Microsoft has ever created. This tutorial has been created using the Visual C++ 2005 Exress Edition. The IDE is available for free. For now. The Visual Studio was developed in C# language. I can feel it. It is slower than the old good Visual C++ 6.0. It has only the very basic features available. Which is what we want. Of course, there are some gotchas. Installation isn't the easiest thing. It remains a mystery, why the creation of plain win32 applications are disabled by default. We have to manually edit configuration files to make it work. Reserve yourself an evening. And there is no resource editor in this edition.
We show, how we create a new project for developing a plain win32 application. The terminology is as follows. To create an application, we must start a project. And the project must be placed within a solution.
To create a new project, select File, New, Project or press Ctrl+Shift+N.

From project types, select Win32. Select Win32 Console Application. Err. Don't know why it is called a console application. Another mystery. I have noticed, that the Borland C++ Builder calls win32 application also "console" applications. Whatever. Type a name for a new project. The name of the solution is the same by default. We can change it, if we want.
Click OK and Next. Select Windows Application and click on empty project. This will not include a lot of rubbish. Click Finish. I delete the three directories. Header files, Resource files and Source files. Our examples are small and easy. Don't need directories.

Click on the project name. Select Add, New item... . Select C++ file and type a file name. I give the file names .c extensions. Because we are coding in C langugage.
Once we have typed the source code, we must compile it. To compile our code, press Ctrl+F7. We might get this error:
fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
This happens because by default, the compiler uses precompiled headers. Precompiled headers are usuful in larger projects. Which is not our case. So we disable this option. Click Alt + F7. This will show Project Properties dialog. From the tree control on the left, select Configuration Properties, C/C++ and Precompiled Headers. From the combo box on the right, select Not Using Precompiled Headers. Click Apply, Ok. The error shoud dissapear.
