Desktop Win32 code samples

Also see Code samples.

Find a sample for the API you're interested in

You can use Microsoft Visual Studio to search an entire repo's source code to see whether the usage of a particular Windows API is being demonstrated.

  • Clone any of the repos listed in the sections below (or download the ZIP) to your local file system.
  • Then Find in Files in Visual Studio. Set Look in to the folder you cloned or downloaded into, and search for the name of the API you're interested in. Checking Match case gives best results.
  • Be careful of checking Match whole word if the API can be called in various forms—for example, CreateMutex, CreateMutexA, and CreateMutexW. In that case, search for CreateMutex with Match whole word unchecked.

Note

You can install Visual Studio without expense. A Community edition is available—it's free for students, open-source contributors, and individuals. Of course you can do the same thing with any samples repo.

The Windows classic samples repo

The main repo containing sample Windows apps using the Win32 API is the Windows classic samples repo.

DirectX samples

See the DirectX-Graphics-Samples repo for DirectX 12 Graphics samples that demonstrate how to build graphics-intensive applications for Windows 10.

Also see DirectX samples.

Older samples

Older Win32 sample apps can be found in the archived MSDN Code Gallery Microsoft Samples repo.

See also