Choose Your Platform
When you want to create a new desktop application for Windows PCs, the first decision you make is which application platform to use. All Windows application platforms let you create desktop apps like Word, Excel, and Photoshop that run in the classic Windows desktop and take full advantage of that environment's specific features.
This article describes the following platforms and helps you determine the best one for your application.
- UWP, WPF, and Windows Forms. These platforms provide managed runtime environments (the Windows Runtime for UWP, and .NET for Windows Forms and WPF) with many benefits, especially in the areas of developer productivity, sophisticated and customizable UI, and application security. Because these frameworks support visual designers and UI markup for rapidly creating UI, they are particularly well-suited for line-of-business applications.
- Win32 API. The Win32 API (also called the Windows API) provides a first-class development experience without depending on a managed runtime environment like .NET and WinRT. This makes the Win32 API the platform of choice for applications that need the highest level of performance and direct access to system hardware.
UWP, WPF, and Windows Forms
For many desktop application scenarios, the Universal Windows Platform (UWP), WPF, and Windows Forms are the best choice. The following table describes the key benefits of each of these platforms.
|UWP||UWP is a highly customizable platform that uses XAML markup to separate UX (presentation) from code (business logic). It is suitable for desktop applications that that require a sophisticated UI, styles customization, and graphics-intensive scenarios. UWP also has built-in support for the Fluent Design System for the default UX experience and provides access to the Windows Runtime (WinRT) APIs. By adopting Fluent, UWP automatically supports common input methods such as ink, touch, gamepad, keyboard, and mouse. Not only can you use UWP to create desktop applications for Windows PCs, but UWP is also the only supported platform for Xbox, HoloLens, and Surface Hub applications. UWP is our newest, leading-edge application platform.
For more information about UWP, see Get started with Windows 10 apps.
|WPF||WPF is also a highly customizable platform that uses XAML markup to separate UX from code. This platform is designed for desktop applications that require a sophisticated UI, styles customization, and graphics-intensive scenarios. WPF development skills are similar to UWP development skills, so migration from WPF to UWP apps is easier than migration from Windows Forms.
For more information about WPF, see Getting started (WPF).
|Windows Forms||Windows Forms excels at enabling developers to quickly get started building applications, even for developers new to the platform. This is a forms-based, rapid application development platform with a large built-in collection of visual and non-visual drag-and-drop controls. Windows Forms does not use XAML, so deciding later to extend your application to UWP entails a complete re-write of your UI.
For more information about Windows Forms, see Getting started with Windows Forms.
The following table compares various characteristics of Windows Forms, WPF, and UWP in detail.
|Feature or scenario||UWP||WPF||Windows Forms|
|Supported versions||Windows 10||Windows 7 and later||Windows 7 and later|
|UI runtime||Native (C++/WinRT and C++/CX) and managed (.NET Native)||Managed (.NET Framework)
Support for .NET Core 3 is coming soon
|Managed (.NET Framework)
Support for .NET Core 3 is coming soon
|Open source||Yes (Windows UI Library only)||Yes (.NET Core only)||Yes (.NET Core only)|
|Scenarios that have limited support||
1 We have publicly announced features that will address this scenario in a future release of Windows 10.
2 Although the platform lacks first-class API support for this scenario, developers can support this scenario with workarounds.
Using the Win32 API with C++ makes it possible to achieve the highest levels of performance and efficiency by taking more control of the target platform with unmanaged code than is possible on a managed runtime environment like WinRT and .NET. However, exercising such a level of control over your application's execution requires greater care and attention to get right, and trades development productivity for runtime performance.
Here are a few highlights of what the Win32 API and C++ offers to enable you to build high-performance applications.
- Hardware-level optimizations, including tight control over resource allocation, object lifetimes, data layout, alignment, byte packing, and more.
- Access to performance-oriented instruction sets like SSE and AVX through intrinsic functions.
- Efficient, type-safe generic programming by using templates.
- Efficient and safe containers and algorithms.
- DirectX, in particular Direct3D and DirectCompute (note that UWP also offers DirectX interop).
- C++ AMP.
Win32 and C++ for traditional desktop applications
When writing a desktop application in C++, you can choose Win32 or MFC for the UI, or a host of third-party application frameworks that also support non-Windows platforms.
- Win32: This is the handle-based, C-language API of the Windows platform, including but not limited to UI functionality such as windowing, drawing, and UI controls. Because it is a low-level, C-language API based on handles, it's an infrequent choice for creating modern, UI-intensive apps. However, it supplies the basic APIs necessary to interact with the Windows platform, and is a suitable choice for apps that have simple UI requirements or that just want the Windows UI to stay out of the way as much as possible for example, games.
- MFC (Microsoft Foundation Class Library): This is the venerable application framework and UI library that has served Windows developers since 1992. It's a thin C++ wrapper over the handle-based, C-language Win32 API and provides object-oriented interfaces for many of the predefined windows, common controls, and other Windows objects. Although many modern UI frameworks in the .NET ecosystem surpass MFC in convenience, it is still the native UI framework of choice for many C++ developers creating applications for the Windows desktop.
- Third-party application frameworks: Because C++ can run on a wide variety of platforms and isn't tied to Windows or the .NET runtime, third-parties have developed new application and UI frameworks for C++ to ease development of cross-platform applications with rich user interfaces. Some of these frameworks provide their own look & feel, while others such as wxWidgets or Qt use or emulate the native control set of the platform. Using these libraries, it's possible to share nearly all of an application's source code between versions of the application that run on Windows or other platforms, such as OSX or Linux.