Author Topic: Tutor_01 (C++ VS2022 GDImage64 tutorial)  (Read 7 times)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1924
    • zapsolution
Tutor_01 (C++ VS2022 GDImage64 tutorial)
« on: Today at 08:45:28 am »
First post of a serie, translated from the "WinDev tutorial",
to explain the use of GDImage64 in procedural* programming mode with Visual Studio 2022.

About Tutor_01
This is a GDImage "Hello World" project, based on "Programming Windows" by Charles Petzold.

All the child controls are created in the CreateControls() procedure.
Among them, CreateWindowExW(0, GDImageClassName, Resource((WCHAR*) L"paintbrush.png"), ...), is the one used by every GDImage container.
Resource((WCHAR*) L"paintbrush.png"), means use this image to paint the background of the control, it works like the desktop wallpaper background in Windows.

If the size of the image is larger that the window, then scrollbars are used to move the content.
This is shown in context when you press the "Capture screen" button,
and GDImageCaptureScreen() is the code that performs the capture.

You can also use a gradient to paint the background with
        // Use a GDImage gradient color to paint the background
        ZI_SetProperty(hCtrl, ZI_GradientTop, ZD_ARGB(255, 0,0,64));
        ZI_SetProperty(hCtrl, ZI_GradientBottom, ZD_ARGB(255, 0,240,255));

So far the Status Bar is not used.

All child controls are anchored within the main window using the ZI_SetAnchorMode API, and the appropriate ANCHOR_PROPERTY.

Last but not least,
the size of the standalone binary EXE is only 15 Kb, because we use only direct call to the core FLAT API, and get rid of external dependencies, and huge dotNET framework. It is what they call "unmanaged code", but WE are the programmers aren't we?

* procedural programming mode, is based on direct use of the FLAT API (Windows SDK) that is the core meat of the OS.
« Last Edit: Today at 09:54:06 am by Patrice Terrier »
(Always working with the latest Windows version available...)