csammisrun

A rare situation

Chapter 0

without comments

What is this tutorial?

Simply put, this is a tutorial on GUI programming using the Win32 API. Hopefully it’ll end up covering a wide range of topics, from basic window creation to simple controls to more advanced GUI topics such as menus and custom dialog boxes. It is not a tutorial on MFC (Microsoft Foundation Classes)…for a good explaination as to why this is, see why I wrote this tutorial.

Who did I write it for?

This is written for anyone who wants to know more about GUI programming using the Win32 API. If you don’t know anything about the topic, this is a good place to learn because I’ll start from the simple basics. If you already have some experience, but want to brush up or learn more, I have no idea how useful this will be. Let me know if it is :)

For that matter, why did I write it?

I wrote this to fill a void. I had mastered VB, using API calls for just about everything, and I wanted to move on to a directly compiled language that didn’t need a runtime to distribute. The obvious choice was Win32 API work, using C/C++ (which I already knew well). However, when I proceeded to look for resources in learning, I found precious precious few tutorials online, and they didn’t cover half of what I wanted to do. Ideally, this tutorial will meet and exceed the expectations of anyone who has, or wants to, go through the same process I did.
Now, why didn’t I write an MFC tutorial, since there’s a lack of those too? Well…I’m not fond of MFC. I’ve never fully appreciated the object-oriented “features” that C++ uses (I much prefer more complete OO languages like Java, and now C#). If I am going to program in a C-style language, I’m probably doing it because I want to use C-style constructs and not objects. So there. Win32 API it is!

What you need to play with the examples

First, you need to know how to use C/C++. If you don’t know it at least to the level of being able to use pointers, you may have some trouble following every example. That’s not to say that the code will be completely inaccessable to you, it just may need a bit more explaining than I provide.
Second, you’ll need Microsoft Visual Studio 6. Chapter one will guide you through the creation of projects in VS6. The examples given with this tutorials consist of project workspaces built with using VS6, although if you don’t have it the .cpp source files should work with any version of VS. I can’t speak for Borland or any other compiler, but feel free to try!
Third, you’ll need access to the Microsoft Developer’s Network (MSDN) Library. The MSDN Library was priceless in assisting me with learning the nuances of Win32 API programming, and I believe very much that they could help anyone else as well. If you don’t have access to a local copy of the Library, one is available online at http://msdn.microsoft.com/library/

A note on terminology

I’m more or less making this up as I go along, but having a consistent way of marking things will make everyone’s life easier…

  • The name of any Win32 API function will be a bold hyperlink to that function’s entry in the glossary of this tutorial
  • Words in italics are concepts or simply something I want to emphasize.
  • Code can be displayed two ways. Little snippets, like variables and function names names, are in . Larger chunks of code, such as API prototypes, are in PREformatted form.

Other than that, you’re good to go! On to chapter one

Back to contents

Written by Chris

May 29th, 2007 at 6:17 pm

Posted in

Leave a Reply