Where can you learn to program with the Windows API?

Are there any good online tutorials that teach you how to program with the Windows API? Everything i find is always about GUI's. Im fine with just working with the console but so far i have yet to find anything that teaches none GUI (or at least dosent force you to use it) and dosent only use Visual Studio since i prefer Code Blocks.
Last edited on
Err... well... there's little reason to use WinAPI unless you're going to make GUIs with it... which is probably why there aren't many (any) tutorials on non-GUI WinAPI.

What are you hoping to accomplish with WinAPI? Other than make your programs Windows-only?
And even if one is primarily developing Windows applications, you'll quickly outrun the available resources once you start to get into details of using specific controls. The basic resources that I used are:

1. Petzold: Programming Windows, Fifth Edition
This covers all the basic details of creating Windows programs, but doesn't get into the Common Controls much, which is where the heavy lifting is done.
2. Nancy Clutz: "Programming the Windows 95 User Interface"
A good starting place for Common Controls, unfortunately it never was updated for WinXP and later controls. Book is hard to find, accompanying CD is even harder!
3. Microsoft Platform SDK, February 2003
Note that the February 2003 edition (which was still available from MSDN as of a couple of years ago) is the last edition which still supported Visual C++ 6, and therefore basic C development tools. The Samples contain countless examples which can usually be built as small, stand-alone utilities. I don't think I could have gotten Virtual Listview controls to work without their example!!
4. various online references will provide small clues:
http://www.catch22.net - he has *wonderful* code snippets in his "win32 tips and tricks" pages (under Tutorials)
Forger's win32 tutorials: http://www.winprog.org/tutorial/
various Microsoft MVP pages: http://www.mvps.org/
and others.

In spite of all these, I had endless headaches, and alot of simply guessing, to solve basic problems such as using different fonts in different cells of a Virtual Listview, or how to implement Tab Controls. In many cases I simply stumbled upon a site which had an simple example of how to solve some detailed problem, in a form that I could actually build (I use MinGW toolchain for my Windows development).

I recommend starting Windows programming using WinAPI; it will give you valuable experience in interpolating from incomplete data!

Oh, and for accessing the general Windows System functions, I used:
Johnson M Hart: "Windows System Programming" and
Marshall Brain: "Win32 System Services".

There's also system-programming examples in the Platform SDK.
Last edited on
Disch wrote:
Err... well... there's little reason to use WinAPI unless you're going to make GUIs with it...

Sure, nobody needs access to the file-system, directory management; comunication with devices, networking, multithread, process administration; if they aren't using a GUI
Many thanks Gorlash, ive seen the Forgers page before but i never knew if it was really worth taking a look at but i guess i have to find somewhere to start.

And Disch hat i hope to learn from it is to be able to code things like this (this isnt full source).

This code is from a programmer that helped me make a program, but the point is things like HINSTANCE LoadLibrary FreeLibrary etc all use the WINAPI and this lets me use a DLL that he coded. The completed program was just a console application but it still used window functions that would be very useful im sure if i could learn and understand enough to do it on my own. I understand some of this but pretty much everything windows related i draw a blank on because i havent learned jack about it yet.

typedef void (*SignFunc)(const char*, const char*, const char*, const char*, char*, int);
SignFunc Sign = NULL;
HINSTANCE hBankSign = LoadLibrary("BankSign.dll"); 

if (hBankSign != NULL) 
    Sign = (SignFunc)GetProcAddress(hBankSign, "Sign");
    if (Sign != NULL) 
        char* buffer = new char[Bank.length() + 100];
        Sign(AuthorAccountNumber.c_str(), UserAccountNumber.c_str(), BankName.c_str(), Bank.c_str(), buffer, (int)Bank.length() + 100);
        AfterSign = buffer;
        delete[] buffer;
        cout << "Failed to find the function for signing the bank!";

    std::cout << "BankSign.dll Failed To Load!" << std::endl;

if (AfterSign != "")


Last edited on
The easier (and more crossplatform friendly) way to use external libs is to #include their headers and link to their .lib/.so file.

The programmer that gave you that dll should have also given you some other files that would allow you to use it more traditionally.

The only time you really need to link to a lib at runtime like that is if you don't know how many/which libs you'll be linking to (as is sometimes the case when using something like a plugin system)
Last edited on
It was more of an example than what im actually working on. Im all done with the code already that i posted.
Alright. I guess I was just curious =)
Topic archived. No new replies allowed.