All the code in this book was written primarily in C, C++ and, to a lesser extent, C# using Microsoft Visual Studio 2005 Team Suite Service Pack 1 and the Windows Software Development Kit (SDK). For C and C++ development Visual Studio was installed first followed by the Windows SDK. Next, we added references to the various Windows SDK headers and libraries to Visual Studio so it would read from the updated directories first. You can do this by performing the following steps:
Open Visual Studio
Select Tools | Options
Navigate to and expand Projects and Solutions
Select VC++ Directories
Click the New Line icon
Add the directory to the Windows SDK include files
Repeat the steps above for the executable and library files. The following figure shows the dia-log in question. You can also simply accept the option to update your environment when you install the SDK – remember to restart the development environment.
Finally, you should add the following line before you include any header files in your application. A good place is the first line in stdafx.h.
#define _WIN32_WINNT 0x0600
If you don’t add this line to your code, your code will probably fail to compile if it references functions, definitions, constants or structures new to Windows Vista.
Important | Note that all the sample C and C++ code makes full use of SAL (described in chapter 1) where appropriate and compiles with no warnings at warning level 4 (/W4) and has no PREfast warnings (/analyze.) The only exception is where we show examples of insecure practices. |
For C# development there is no need to change anything to the development environment so long as you are running on a Windows Vista computer.