Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ckormanyos/win_text_simple

win_text_simple makes a simple Win32-API window with dynamic text
https://github.com/ckormanyos/win_text_simple

cpp visual-studio win32api

Last synced: 24 days ago
JSON representation

win_text_simple makes a simple Win32-API window with dynamic text

Awesome Lists containing this project

README

        

win_text_simple
==================



Build Status


Boost Software License 1.0


GitHub code size in bytes



win_text_simple makes a simple Win32-API window with dynamic
_Window_ _Text_.

![](./images/win_text_simple.jpg)

## The Win32-API and ckormanyos/win_text_simple

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.

## Implementation

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.

![](./images/icon.jpg)

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

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.

## References

[1] C. Petzold, _Programming_ _Windows(R)_ _95_,
Microsoft Press 1996.