Samples in the Windows SDK

The Windows SDK for Windows 7 and the .NET Framework 4 (later referred to as the Windows SDK) provides samples for many technology areas in the Windows API. These samples primarily use Visual C++ code. Some samples use Visual C# or Visual Basic to demonstrate operating system features that work with the .NET Framework. For links to additional samples for the .NET Framework on MSDN Code Gallery, see .NET Framework Samples.

This document provides an overview about how to work with the Windows SDK samples. We recommend that you read Building Applications that Use the Windows SDK before you read this document.

The Windows SDK samples that use native code are located in ..\Windows SDK installation folder\Samples\. By default, the Windows SDK installation folder is %ProgramFiles%\Microsoft SDKs\Windows\v7.1\.

The following table describes the contents of each subfolder of the \Samples\ folder.

Sample folder



Provides basic samples that demonstrate how to start using the Windows SDK.


Provides samples that use COM+ to demonstrate services such as queued components and events.


Demonstrates how to use OLEDB to work with data from a variety of sources.


Demonstrates how to incorporate multimedia components such as audio and video into your applications.


Demonstrates how to incorporate networking and related services into your applications.


Demonstrates security practices such as how to protect communications, applications, and systems, and also how to implement parental controls.


Demonstrates systems management and scheduling tasks.


Provides samples that use features of Tablet PC technology.


Demonstrates how to integrate Windows Touch support into native and managed applications.


Demonstrates how to work with Web-related technologies such as XML.


Provides samples that cover a variety of core Windows functionality, for example, threading, performance and diagnostics, computer restarts, memory, and event handling.


Demonstrates how to create Windows applications that have a user interface.


Demonstrates how to work with XML Paper Specification (XPS) documents.

The Windows SDK 7.1 provides the same the compilers and tools that are included in Visual Studio 2010. You can use Visual Studio 2010 or later to upgrade, modify, and build the samples. If you do not have Visual Studio, you can still work with the samples at the Windows SDK command prompt. To open the Command Prompt window, click Start, then All Programs, then Microsoft Windows SDK v7.1, and then Windows SDK 7.1 Command Prompt. For more information about how to use compilers and build tools to create applications that use the Windows SDK, see Building Applications that Use the Windows SDK.


When you work with the SDK samples, we recommend that you copy the samples and paste them in a separate folder so that you can preserve the original source code (otherwise, you would have to reinstall the Windows SDK). By default, the SDK samples are located in the %ProgramFiles% folder; therefore, if you work with the SDK samples directly, you must use administrator credentials to run any code editing and build tools.

You must upgrade sample projects that were created by an earlier version of Visual Studio, for example, Visual Studio 2008, before you can build them. For information about how to use the vcupgrade tool to convert Visual C++ project files to the Visual C++ 2010 project file format, .vcxproj, see Building Applications that Use the Windows SDK.

For example, to upgrade the Direct2DHelloWorld sample, run the following command at the Windows SDK command prompt:

vcupgrade.exe Direct2DHelloWorld.vcproj

This command produces Direct2DHelloWorld.vcxproj as its output. The following section describes how to build the upgraded project.

The previous section describes how to upgrade the Direct2DHelloWorld sample to the Visual C++ 2010 project file format. The following command builds the Direct2DHelloWorld sample for the 32-bit Windows operating system in the Release configuration:

MSBuild.exe Direct2DHelloWorld.vcxproj /t:Rebuild /p:Platform=Win32 /p:Configuration=Release

Important noteImportant

We recommend that you always specify the target computer architecture. If you do not specify the target architecture, MSBuild chooses the first architecture that is listed in the solution file or the default architecture that is specified by the project file.

Some samples require the Active Template Library (ATL) or Microsoft Foundation Classes (MFC) headers and libraries. These headers and libraries are included in all editions of Visual C++ 2010 except for Visual C++ 2010 Express Edition.

Community Additions