C++ GUI Programming for MS Windows

The previous post, Win32 or UWP? looked at some of the advantages and disadvantages of developing C++ applications for either of those two frameworks. This post provides a high-level look at a number of toolkits for GUI programming in C++ for those frameworks. I have no intention of covering all toolkits, only the ones I have used, or contemplated using for more than a few minutes. See Wikipedia for a larger list of GUI toolkits.

MS Windows-Only APIs and Toolkits

Microsoft has provided a number of toolkits and APIs for developing C++ applications on Win32 and UWP. The oldest ones are for Win32 development and the newest ones are for UWP. Because Win32 has been around a much longer time, there are more toolkits for developing Win32 applications than for developing UWP applications. Let’s look at a few.


Any mentions of Win32 in this post also refer to Win64, the 64-bit equivalent of Win32.

Windows API

The Windows API (sometimes referred to as Win32 API) is a C-based library that has been around since the days of Windows 1.0 (originally Win16). This was the first toolkit used to build Windows applications and still remains somewhat popular today, especially for C applications. However, being a C interface, it tends to be long-winded; for example, the first Hello World application built using Win16 required only 150 lines of code.

I would recommend looking at one of the C++ toolkits instead.


MFC, the Microsoft Foundation Classes, was released in 1992 as a very thin wrapper around the Windows API. MFC is still available in various versions of Visual Studio, though it was previously not included in Visual Studio Express versions.

While some people still develop applications using MFC, and of course there is a large number of legacy MFC applications, there are now better choices available for developing new applications.


WTL, the Windows Template Library, was developed originally for use internally by Microsoft, and was later released as an unsupported add-on to Visual Studio. WTL provides a light-weight alternative to MFC.

I have not used WTL so I can’t comment on it, other than it is now available as a download from Sourceforge.


A number of other Win32-specific toolkits have come and gone. As an alternative to any of the toolkits mentioned above, you may wish to consider one of the cross-platform toolkits which are listed in a section below.


Universal Windows Platform is Microsoft’s new framework for building Windows programs. Unlike Win32, which is limited to running on x64/x64 processors, UWP applications can also be built to run on ARM processors. This opens UWP applications up to running on desktops, laptops, tablets, XBox systems, HoloLens systems, Windows phones, and any other hardware that runs Windows 10.

UWP uses the Windows RunTime architecture (WinRT). WinRT provides a set of APIs that expose all of the functionality of Windows 10 to developers. See the Wikipedia entry for more information. .Net and the Common Language Runtime (CLR) are a subplatform of the Windows Runtime.


C++/CX is a set of extensions to Visual C++ for building UWP applications. This greatly reduces the amount of plumbing code required to interface to WinRT, but at the expense of unfamiliar code syntax. All functionality exposed by WinRT can be programmed using C++/CX. C++/CX supports using XAML to define a program’s user interface.


The Windows Runtime C++ Library (WRL) provides a low-level interface to the Windows Runtime. There is more boiler-plate code than in C++/CX, but at least it is standard, though not modern C++. For example, there are no modern types and no move semantics.


C++/WinRT is a standard C++ language projection implemented entirely as a set of header files. It does not use language extensions like C++/CX does, and avoids the complexity, verbosity, and tediousness of WRL.

One disadvantage is that XAML is not currently supported; XAML will be provided in a later version.

Cross Platform Toolkits

All of the toolkits mentioned below have been under active development for 20 or more years. They were started before C++98; to support backwards compatibility, they all suffer from a number of limitations. For example:

  • No namespaces;
  • Use raw pointers rather than smart pointers; and
  • Pass parameters as raw pointers rather than references.

There are many other limitations, but you get the idea.


wxWidgets is the only toolkit that uses native libraries to create and display windows and widgets. On Windows, wxWidgets uses Win32, on OSX it uses Cocoa, and on Linux and other Unix-like systems it uses gtk+. Attempts were made to produce ports for both Android and iOS, but they never got past the pre-alpha stage.


gtkmm is a C++ wrapper around gtk+. gtk+ is the C API that is used on the Gnome desktop for Linux and Unix-like operating systems. It has been ported to Windows and OSX, and generally works well but with a few limitations on the fringes. For example, see my comments about printing and printer properties in Adventures in Cross-Platform GUI Programming and Printing.


Qt is available for the largest number of operating systems: Win32 and WinRT, OSX, Linux and many Unix-like OSes, Android, iOS, and embedded operating systems. Qt is the API used for the KDE desktop which runs on Linux and many Unix-like OSes. It is the oldest and best supported of the cross-platform toolkits. It is under constant development.


The Fast Light Toolkit is the lightest of the toolkits mentioned here. It provides only GUI functionality and does not provide helper classes like the toolkits mentioned above. The look and feel of its widgets is somewhat reminiscent of Motif from the 1990’s.

fltk is available for Win32, OSX, and Linux.


Other toolkits are either lesser known or created for specific purposes, such as toolkits for gaming and toolkits that use and are designed for use with OpenGL, and in some cases, Vulkan.

What Have I Used?

All of my programming in the last 3 years or so has been on MS Windows systems, with most programs using wxWidgets for the GUI. In the past, I programmed using gtkmm and the Win32 API. More than 20 years ago I used MFC. I have also programmed GUIs in other languages, but they are not the topic of this post.


This post has provided a list and overview of a number of toolkits that can be used to program GUIs on computers running MS Windows. Hopefully I have provided sufficient information for you to limit the amount of investigation you need to do to select a GUI toolkit that is appropriate for your new applications.

Additional Information

Additional information on each of the platforms and toolkits may be obtained from the following links:





Win32 or UWP?

Microsoft provides two models or frameworks for programming Windows 10 applications: Win32 and UWP (Universal Windows Platform). This post will look at some of the advantages and disadvantages of each framework.

Win32 API


  • The most widely used framework. After all, it has been around in some form or other since the release of Windows 1.0 in 1985. If you have written Windows programs in C or C++, you have probably programmed at least one of them using the C Windows API or MFC.
  • More applications have been written for Win32 than any other framework.
  • There are a number of alternative toolkits for building Win32 applications that are cross-platform. Therefore, if you use one of these toolkits to build your application, you may be able to port it to other operating systems. See Adventures in Cross-Platform GUI Programming and Printing for some potential problem areas.


  • Limited to Intel x86 and x64 architectures, so desktop and laptop computers only.
  • The Win32 toolkits, including the cross-platform ones, were all started long before modern C++ (C++11 and later). They have kept their APIs to maintain backwards compatibility to previous versions of the toolkits, so if you use one of them, you will be doing a lot of C++98 programming.
  • With the rise in popularity of the Internet, Win32 applications have become open to many security threats that can affect the entire computer system.
  • Will not run on Windows 10 S. This may be a disadvantage if Windows 10 S systems become popular.
  • Microsoft is trying to kill off Win32, though this will take many years to do.


UWP is the “modern” Windows API. It is implemented as a set of COM APIs. You do not (necessarily) reference these COM APIs directly, but rather through language specific projections.


  • Applications can be programmed to run on desktops, laptops, tablets, XBox systems and HoloLens systems. You can include Windows phones as well, although they seem to be dying out.
  • UWP applications are sandboxed, and therefore do not suffer from many of the security problems that Win32 apps do.
  • Applications are Windows Store ready.
  • Apps will run on Windows 10 S systems, which can load only UWP applications and only from Windows Store.
  • This is the future of application development, at least as Microsoft sees it at the moment.


  • This framework is relatively new, so you probably have a new toolkit to learn.
  • Because this framework is relatively new, there are very few C++ toolkits available for developing GUI applications using C++.
    • The most widely-used toolkit for C++ GUI programming of UWP applications (C++/CX) uses proprietary extensions to the C++ language (yuck!!!!). You are limited to using Visual C++ to build your applications.
    • The Windows Runtime C++ Template Library (WRL) provides lower-level access than C++/CX to the UWP API, but at least you can code using standard C++ rather than rely on compiler extensions.
    • There is a C++ header library (C++/WinRT) originally developed by Kenny Kerr to provide a C++ callable interface for UWP GUI programming. Kenny now works for Microsoft on the team that is continuing development of C++/WinRT. It only provides some of the functionality available in C++/CX, but work is continuing on providing additional functionality. The header library is available on GitHub; it is not included in the Windows 10 SDK or in Visual Studio.
    • Alternatively, you could do the GUI programming in .Net languages and the rest of the programming in C++.
  • There is currently no way, short of a complete rewrite of the application, to port a C++ UWP application to other operating systems.

What Now?

This post has provided a look at developing applications in C++ for Windows 10. Specifically, it has documented a number of advantages and disadvantages of selecting either the Win32 or the UWP framework.

A few C++ GUI toolkits were mentioned in the various sections, above. The next post will look more closely at these and a number of other more popular C++ GUI toolkits for developing applications for Win32 and UWP.