Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
C++/WinRT is a standard C++17 language projection for Windows Runtime (WinRT) APIs. It's implemented as a header-file-based library and designed to provide first-class access to the modern Windows API from any standards-compliant C++17 compiler.
C++/WinRT lets you both consume and author Windows Runtime APIs using standard C++. It's the recommended replacement for C++/CX and the Windows Runtime C++ Template Library (WRL).
Get started
- Introduction to C++/WinRT — an overview of what C++/WinRT is and why it exists.
- Get started with C++/WinRT — set up your development environment and write your first C++/WinRT app.
Core concepts
- Concurrency and asynchronous operations — author and consume asynchronous operations with coroutines.
- A completion source sample — reporting progress, timeouts, and other advanced patterns.
- Collections with C++/WinRT — create and consume Windows Runtime collection types.
- Boxing and unboxing values — wrap scalar and array values for APIs that expect IInspectable.
- Standard C++ data types and C++/WinRT — use standard C++ types with Windows Runtime APIs.
- Value categories and references — understand lvalues, rvalues, and how C++/WinRT uses them.
- Agile objects — how agility works in C++/WinRT.
- String handling — work with winrt::hstring and standard string types.
- Error handling — handle and produce errors with C++/WinRT.
Authoring and interop
- Author COM components — implement classic COM coclasses with C++/WinRT.
- Consume APIs — call Windows Runtime APIs from C++/WinRT.
- Author APIs — define and implement your own Windows Runtime types.
- Interop between C++/WinRT and the ABI — convert between ABI and C++/WinRT objects.
- Passing parameters into the ABI boundary — efficiently pass values across the ABI.
- Use a C# component from C++/WinRT — consume a C# Windows Runtime component.
XAML and UI
- XAML controls; bind to a C++/WinRT property — data-bind a XAML control to a C++/WinRT property.
- XAML items controls; bind to a collection — bind to an observable collection.
- XAML custom controls — create a custom (templated) control.
Samples
Reference and diagnostics
- Naming conventions — C++/WinRT naming rules and conventions.
- Native debug visualization (natvis) — use Visual Studio natvis to debug C++/WinRT types.
- Macros — C++/WinRT preprocessor macros.
- Diagnosing direct allocations — detect and fix direct allocations of implementation types.
- Details about destructors — understand destructor behavior in C++/WinRT.
Migration guides
Windows developer