SDK sample content

The SDK contains samples in the following topic areas:

  • 430 Windows Presentation Foundation samples
  • 140 Windows Communication Foundation samples
  • 60 Windows Workflow Foundation samples
  • 200 New to Windows Vista (Win32/COM-based) samples
  • 23 Cross technology samples

Windows SDK samples

.NET Framework (managed code) samples

Microsoft .NET Framework samples are installed with the SDK documents, providing a mechanism to view and browse samples in context of the rest of the documents. These samples fall into three main categories:

  • Compiled sample applications users can download and run, ranging from Hello World type applications to more complex samples.
  • Tutorial-like examples, often presented in topics which teach how to build a sample application, taking users from a blank screen to a running application.
  • Code snippets which are embedded in topics throughout the documentation set. The most common example of this type of code is found in API reference topics, which often contain small code blocks showing the syntax and usage of the members of an API.

Sample document topics contain options for viewing and copying sample source files and for downloading sample projects as ZIP files to a user’s computer. Each sample topic contains at least one source code selection box that lists all the sample files. There is one box for each programming language provided by the sample. If a user is viewing this documentation on the Web instead of in local Help, a link to download the sample is provided.

The .NET Framework samples are also available outside the documents, in .ZIP format installed to Program Files\Microsoft SDKs\Windows\[version number]\samples. This content can be deselected during SDK setup. The .ZIP files provide a mechanism to extract large subsets of samples at once.

Win32 (unmanaged code) samples

The Windows samples demonstrate Windows operating system features primarily using native code. These unmanaged Win32 samples are not included in the documentation. They are installed as loose files to subdirectories of \Program Files\Microsoft SDKs\Windows\[version number]\samples. This content can be deselected during SDK setup. A few samples with some managed code (PowerShell, Tablet PC) install with the Win32 samples. The Win32 samples directory layout for the Windows SDK is:


Building the samples

Building samples under Windows Vista or later operating systems should be done in a directory outside of Program Files to which there is write access to avoid issues with file and registry virtualization. This makes it possible to maintain an unmodified copy of the SDK samples. To build from the command line:

  1. Copy the sample to a working folder not under \Program Files.
  2. Open the Windows SDK CMD shell (Start> All Programs> Microsoft Windows SDK> CMD Shell).
  3. Build the sample from the command line as follows:
    • Build a makefile by typing nmake
    • Build a .csproj file by typing msbuild mysample.csproj /p:platform=[win32|x64|IA64]
    • Build a .vbproj file by typing msbuild mysample.vbproj /p:platform=[win32|x64|IA64]
    • Build a .sln file by typing msbuild mysample.sln /p:platform=[win32|x64|IA64]
    • Build a .vcproj by typing vcbuild mysample.vcproj /p:platform=[win32|x64|IA64]

It is important to specify the build platform when using MSBuild, otherwise the first platform listed in the solution or project file will be built.