Author Topic: Tutor_11 (C++ VS2022 GDImage64 tutorial)  (Read 2138 times)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1983
    • zapsolution
Tutor_11 (C++ VS2022 GDImage64 tutorial)
« on: July 18, 2023, 04:12:19 pm »
Eleventh post of a series, translated from the "WinDev and PowerBASIC",
to explain the use of GDImage64 in procedural* programming mode with Visual Studio 2022.

About Tutor_11
This tutor introduces the use of a TOAST window to notify the user about a specific event.
It pops up from the bottom right edge of a parent window, and auto-hides itself after 15 secondes.

This project uses 2 GDImage controls:
The first, is a child window working in DWM transparent mode, using the whole client area to display a helper message.
The second, is a popup child window (the Toast window).

ZI_DwmEnable
This API enable the DWM transparent mode for a specific window (Main and Toast).

ZI_CreateImageComposited
This API is used to create on the fly a composited image from multiple object layers,
they are defined first in a ZOBJECT array using any GDImage object type.
The z-order composition will match the array order, the lower indice at the bottom, the higher on top.
All layers are composited in memory, then saved to file into the temporary folder.

ZI_CreateWindowFromImage
This API creates the Toast window. It uses the magenta color, or the alpha channel to build a region on the fly.
In the example we use the previously saved composited image from the temporary folder.

The width/height of a Toast window is computed to fit the size of the text message.

Last but not least,
the size of the standalone binary EXE is only 15 Kb.


   
* procedural programming mode, is based on direct use of the FLAT API (Windows SDK) that is the core meat of the OS.
« Last Edit: August 18, 2023, 10:22:12 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)