Winapi-GUI-programming-in-Cpp17

Winapi GUI in C++17 – Introduction.
Copyright © 2025 Alf P. Steinbach

How do I go beyond making textual console programs?

Table of Contents generated with DocToc

Introduction.

Beyond a beginner’s purely text based console programs are ordinary Windows (or Mac, or Linux, …) programs that present windows with graphical elements such as buttons, menus and edit fields, and, yes, general graphics, where you can use the mouse to interact with the program. They’re called GUI programs for short. “GUI” means Graphical User Interface.

Currently — late 2025 — the simplest way to do general GUI programming is via the trio of dedicated formal languages HTML, CSS and JavaScript, used to define respectively content, styling and functionality. This is the same trio of languages used for web pages. With these three dedicated languages a GUI program is doable even for a programming novice, if one accepts that the app runs in a browser, but what one can do on the local computer is limited.

Using instead a single general programming language such as Python, Java or C++, a GUI program is an ordinary local program and can do anything, but it’s harder to do than a text based console program. Not just a little harder. We’re talking very much harder for the user interface parts.

And of the Python, Java and C++ languages C++ is the hardest, not just because C++ is inherently hard (it is), but also because there’s no standard basic GUI library for C++, unlike Python with tkinter and Java with the Swing and JavaFX GUI frameworks. The most commonly recommended cross platform C++ library for general GUI applications is an old one called Qt. Other conventional “only C++” cross platform GUI libraries include WxWidgets, gtkmm and FLTK; RmlUi is a more modern HTML + CSS + C++ based one.

A general GUI library such as Qt can be used also for a game program. But games are special e.g. in that the presentation and state changes continuously, thus requiring a slightly different approach. This means that for games it’s more practical to use a GUI library dedicated to games programming, and the most common recommendations for novices appear to be SFML and Dear ImGui.

If instead of using a third party C++ library such as Qt, SFML or Dear ImGUI you want to create GUI programs just with what you already have at hand, namely by direct use of the Windows API (application program interface, the functions etc. that Windows provides), then this tutorial is for you.

In essence using the OS’ API is doing yourself what the libraries would do for you.

But regarding the complexity it’s you pitted against Microsoft, and there can be some satisfaction in winning that contest…

Not the least, you’ll learn about How Things Work™ at a more fundamental level than the usual GUI libraries.