Chapter 1
Using Visual Studio and MSDN
It’s probably safe for you to skip this chapter if you’re already comfortable using Visual Studio and MSDN. If that’s the case, by all means, go directly to chapter two and start laying out some code. If you’re not though, or you’d like a reference for specifically what I’ll be doing with this tutorial, that’s what this chapter is for.
Creating a project
Start up Visual Studio, and select “New…” from the File menu. The following dialog will appear:

Naturally, this will look slightly different depending on your version of Windows and your installation of Visual Studio. Highlight “Win32 Application” in the list of projects. The “Location” field tells VS where to create your project and its accompanying files. The “Project Name” field will be appended onto this directory, and also be the name of the executable file that VS will eventually build for you, so pick carefully
Example: Your “Location” field is “C:\Projects”, and your project name is Chapter1. VS will create C:\Projects\Chapter1, deposit the files it creates into this new subdirectory, and build Chapter1.exe as the final executable.
Click OK when you’ve entered the location and project name, and you’ll be presented with this dialog:

For the purposes of this tutorial, we’ll be choosing to create “A simple Win32 application.” The next dialog confirms this, and states that it is creating the following files:
- StdAfx.cpp — A C++ source file that serves to compile StdAfx.h. Just take its existence for granted, there’s nothing you’ll ever do with it
- StdAfx.h — This is the file in which you’ll be putting any #include directives that you will need for your particular application, along with #define directives, consts, or other definitions that must be global to your program
- Chapter1.cpp — This is the main C++ source file that we will be editing, more on its contents in chapter 2
Looking up entries in MSDN
I can’t state the importance of MSDN enough. Aside from the copious bits of sample code the libraries provide, the sheer amount of pure reference present is enough to satisfy anyone who wants to know the littlest thing about Windows programming. I personally have the October 2002 edition of MSDN installed on my computer, but I’ll use the website to demonstrate using the libraries to search for specific functions.
Pull up your favored web browser and go to http://msdn.microsoft.com/library, the online MSDN Library index. In the upper-left corner, there’s a box to search the index. Type in “CreateWindowEx” and click “GO”

The results that are returned will vary, naturally, but you want to look for certain things in the returned entires to make sure you’re getting the *right* result, such as:
- First off, if the title of the article isn’t the name of the function, you’re *probably* not going to get what you’re looking for
- The first item under the title of the entry is the direct URL for that article. The URL should contain something like WinUI, WindowsUserInterface, anything that more or less screams “THIS IS FOR PROGRAMMING A GUI USING WINDOWS.” Sometimes you’ll get an MFC function, but usually the names of the functions are different enough that you can tell the difference
Obviously, because I have no idea what *you* personally will search for, I can’t be more specific than that. As you continue to gain experience with Win32 API programming and usage of MSDN, you’ll be able to intuit what you’re looking for much more easily. Trust me!
And now, you’re ready for chapter two…
