win_text_simple makes a simple Win32-API window with dynamic Window Text.
In chapter 2 of [1], the author describes and provides a code listing for a simple text-based window. The example uses what was then known as the Windows 95 API, which would later become the Win32-API.
Microsoft(R) Visual Studio(R) products (even Community-Editions) support the traditional Win32-API, also for x64 builds. This API is very conventient and can still be used today to program Windows(R)-based applications.
ckormanyos/win_text_simple generally follows the code supplied in Fig. 2-1 The HELLOWWIN Program of [1]. It does, however, add additional timer and threading facilities to create a dynamic, text-based Win32-API program.
The main assignment of the program is a non-trivial functionality.
A self-written WM_TIMER event/handler is used to query and
dynamically print the value of std::chrono's
high-performance clock in the text field of the window.
A decimal 64-bit representation (in nanoseconds)
of the running tick is used.
The application is written in header-only, modern C++ and is compatible with C++14, 17, 20, 23 and beyond.
The standard Windows(R) message pump technology is used.
An additional WM_TIMER message and handler have been added
for handling the interaction with std::chrono.
The window features its own specialized icon which has been created with the standard icon editor and loaded at application start.
An object of type std::thread (in modern C++) is used
for synchronization and properly shutting down and de-registering
the window at application close.
Continuous integration runs in GitHub Actions using the windows-latest
image. The CI job builds the x64-Release version
of the application and checks for the existence of the executable.
[1] C. Petzold, Programming Windows(R) 95, Microsoft Press 1996.