Top Related Projects
This repo contains samples that demonstrate the API used in Windows classic desktop applications.
This repo contains driver samples prepared for use with Microsoft Visual Studio and the Windows Driver Kit (WDK). It contains both Universal Windows Driver and desktop-only driver samples.
Samples and Tools for Windows ML.
Quick Overview
The microsoft/Windows-universal-samples repository is a collection of Universal Windows Platform (UWP) sample applications demonstrating various Windows API features and functionalities. These samples serve as practical examples and learning resources for developers building applications for Windows 10 and later versions.
Pros
- Comprehensive coverage of UWP features and APIs
- Official samples from Microsoft, ensuring accuracy and best practices
- Regularly updated to reflect the latest Windows SDK changes
- Well-documented with explanations and comments in the code
Cons
- Primarily focused on UWP, which may not be as relevant for developers targeting other platforms
- Some samples may be complex for beginners
- Requires Windows 10 or later for development and testing
- May not cover all possible use cases or scenarios for each API
Code Examples
As this is a repository of sample applications rather than a code library, specific code examples are not provided here. However, developers can explore individual sample projects within the repository to find relevant code snippets and implementations.
Getting Started
To get started with the Windows-universal-samples:
-
Clone the repository:
git clone https://github.com/microsoft/Windows-universal-samples.git
-
Open the desired sample project in Visual Studio.
-
Ensure you have the latest Windows SDK installed.
-
Build and run the sample application to see it in action.
-
Explore the code and documentation to understand the implementation details.
For more detailed instructions, refer to the README.md file in the repository root and individual sample project folders.
Competitor Comparisons
This repo contains samples that demonstrate the API used in Windows classic desktop applications.
Pros of Windows-classic-samples
- Focuses on traditional desktop applications, providing examples for Win32 API and COM
- Includes samples for older Windows versions, beneficial for maintaining legacy systems
- Offers a wider range of low-level system programming examples
Cons of Windows-classic-samples
- Less emphasis on modern UI and UX patterns
- May not fully leverage newer Windows features and APIs
- Potentially more complex setup and dependencies for some samples
Code Comparison
Windows-classic-samples (Win32 API):
HWND hwnd = CreateWindow(
szWindowClass,
szTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
500, 100,
NULL,
NULL,
hInstance,
NULL
);
Windows-universal-samples (UWP):
MainPage rootPage = new MainPage();
Window.Current.Content = rootPage;
Window.Current.Activate();
The classic sample uses the Win32 API to create a window, while the universal sample uses UWP framework for a more modern, touch-friendly UI approach. Windows-classic-samples generally require more boilerplate code for basic functionality, whereas Windows-universal-samples leverage higher-level abstractions provided by the UWP framework.
This repo contains driver samples prepared for use with Microsoft Visual Studio and the Windows Driver Kit (WDK). It contains both Universal Windows Driver and desktop-only driver samples.
Pros of Windows-driver-samples
- Focuses on low-level system programming and hardware interaction
- Provides examples for various driver types (e.g., KMDF, UMDF, WDM)
- Includes samples for specific hardware components like USB, audio, and networking
Cons of Windows-driver-samples
- Steeper learning curve due to complexity of driver development
- Requires more specialized knowledge and development tools
- Limited applicability for general app developers
Code Comparison
Windows-driver-samples (KMDF driver):
NTSTATUS
DriverEntry(
_In_ PDRIVER_OBJECT DriverObject,
_In_ PUNICODE_STRING RegistryPath
)
{
WDF_DRIVER_CONFIG config;
NTSTATUS status;
Windows-universal-samples (UWP app):
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
Summary
Windows-driver-samples is tailored for system-level developers working on hardware drivers, offering in-depth examples for various driver types. It requires more specialized knowledge but provides valuable resources for low-level system programming. In contrast, Windows-universal-samples caters to a broader audience of app developers, focusing on Universal Windows Platform (UWP) applications with a gentler learning curve and wider applicability for general app development scenarios.
Samples and Tools for Windows ML.
Pros of Windows-Machine-Learning
- Focused specifically on machine learning integration in Windows applications
- Provides tools and samples for working with ONNX models in Windows
- Includes examples of hardware acceleration for ML inference
Cons of Windows-Machine-Learning
- Narrower scope compared to the broader range of Windows features covered in Windows-universal-samples
- May require more specialized knowledge in machine learning concepts
- Fewer overall samples and code examples
Code Comparison
Windows-Machine-Learning sample:
LearningModel model = await LearningModel.LoadFromFileAsync(modelFile);
LearningModelSession session = new LearningModelSession(model);
LearningModelBinding binding = new LearningModelBinding(session);
binding.Bind("input", inputTensor);
var results = await session.EvaluateAsync(binding, "output");
Windows-universal-samples example:
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/sample.txt"));
string text = await FileIO.ReadTextAsync(file);
TextBlock outputText = new TextBlock();
outputText.Text = text;
Summary
Windows-Machine-Learning is tailored for developers working on ML integration in Windows apps, offering specialized tools and examples. Windows-universal-samples covers a broader range of Windows features and APIs, making it more suitable for general Windows app development. The code examples reflect their different focuses, with Windows-Machine-Learning demonstrating ML model loading and evaluation, while Windows-universal-samples shows more general Windows functionality like file I/O.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Universal Windows Platform (UWP) app samples
This repo contains the samples that demonstrate the API usage patterns for the Universal Windows Platform (UWP) in the Windows Software Development Kit (SDK) for Windows 10. These code samples were created with the Universal Windows Platform templates available in Visual Studio, and are designed to run on desktop, mobile, and future devices that support the Universal Windows Platform.
Note: If you are unfamiliar with Git and GitHub, you can download the entire collection as a ZIP file, but be sure to unzip everything to access shared dependencies. For more info on working with the ZIP file, the samples collection, and GitHub, see Get the UWP samples from GitHub. For more samples, see the Samples portal on the Windows Dev Center.
Universal Windows Platform development
These samples require Visual Studio and the Windows Software Development Kit (SDK) for Windows 10.
Additionally, to stay on top of the latest updates to Windows and the development tools, become a Windows Insider by joining the Windows Insider Program.
Using the samples
The easiest way to use these samples without using Git is to download the zip file containing the current version (using the following link or by clicking the "Download ZIP" button on the repo page). You can then unzip the entire archive and use the samples in Visual Studio.
Notes:
- Before you unzip the archive, right-click it, select Properties, and then select Unblock.
- Be sure to unzip the entire archive, and not just individual samples. The samples all depend on the SharedContent folder in the archive.
- In Visual Studio, the platform target defaults to ARM, so be sure to change that to x64 or x86 if you want to test on a non-ARM device.
The samples use Linked files in Visual Studio to reduce duplication of common files, including sample template files and image assets. These common files are stored in the SharedContent folder at the root of the repository, and are referred to in the project files using links.
Reminder: If you unzip individual samples, they will not build due to references to other portions of the ZIP file that were not unzipped. You must unzip the entire archive if you intend to build the samples.
For more info about the programming models, platforms, languages, and APIs demonstrated in these samples, please refer to the guidance, tutorials, and reference topics provided in the Windows 10 documentation available in the Windows Developer Center. These samples are provided as-is in order to indicate or demonstrate the functionality of the programming models and feature APIs for Windows.
Contributions
These samples are direct from the feature teams and we welcome your input on issues and suggestions for new samples. At this time we are not accepting new samples from the public, but check back here as we evolve our contribution model.
This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
See also
For additional Windows samples, see Windows on GitHub.
Samples by category
App settings
App package information | Application data | Store |
Audio, video, and camera
Communications
Bluetooth RFCOMM chat | Real-time communication | SMS send and receive |
Contacts and calendar
Appointment calendar | Contact cards | Contact panel |
Contact picker | UserDataAccountManager |
Controls, layout, and text
Custom user interactions
Basic input | Complex inking | Ink analysis |
Low latency input | Pen haptics | Simple inking |
Touch keyboard | Touch keyboard text input |
Data
Compression | Content indexer | Logging |
PDF document | Serializing and deserializing data | x:Bind |
x:DeferLoadStrategy | XML DOM | XmlLite |
Deep links and app-to-app communication
App services | Jump list customization | Remote systems |
Sharing content source app | Sharing content target app | User activities |
Devices and sensors
Files, folders, and libraries
File access | File and folder thumbnail | File picker |
File picker provider | File search | Folder enumeration |
Library management | Semantic text query |
Gaming
Direct3D game | DirectX and XAML game |
Globalization and localization
Graphics and animation
Holographic
Identity, security, and encryption
Launching and background tasks
Association launching | Background activation | Background task |
Extended execution | Multi-instance apps | Suspend and resume |
Maps and location
Geolocation | Geotag | MapControl |
Navigation
Back Button | Master/detail | Pivot |
Projection |
Networking and web services
Platform architecture
Capabilities | Custom capabilities | In-process component authoring |
In-process component authoring | Out-of-process component authoring | Version adaptive code |
Speech and Cortana
Cortana voice command | Speech recognition and synthesis |
Tiles, toasts, and notifications
Notifications | Secondary tiles |
Top Related Projects
This repo contains samples that demonstrate the API used in Windows classic desktop applications.
This repo contains driver samples prepared for use with Microsoft Visual Studio and the Windows Driver Kit (WDK). It contains both Universal Windows Driver and desktop-only driver samples.
Samples and Tools for Windows ML.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot