Recent Posts

Pages: 1 2 3 [4] 5 6 ... 10
31
The concept / Re: Tutor-17 (C++ VS2022 GDImage64.dll tutorial)
« Last post by Shao Voon Wong on September 02, 2023, 08:42:37 am »
Hi Patrice,

Cool animation. Why is there no program window and the background is totally transparent when I run the program from Visual Studio? Is there a trick to it?

When I double-click to run the program from the release folder on File Explorer, I get to see the program window as shown on this forum thread.
32
The concept / Tutor-17 (C++ VS2022 GDImage64 tutorial)
« Last post by Patrice Terrier on September 01, 2023, 07:24:42 pm »
Seventeenth 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_17
This is a C++ transcription of a PowerBASIC demo written in 2009 with the official release of GDImage 5.00.
It was the first version able to mix 2D and 3D OpenGL into the same graphic control.
The application itself is skinned with WinLIFT, and share the same background wallpaper with all child controls.

The Cube
Is using 3 OpenGL cubes (1 main and 2 clones), with each face using a distinct texture.

Wallpaper background
You can click with the right mouse button on the main cube, to change the wallpaper background.

WinLIFT 6.00
Is an experimental version converted to VS2022, the whole code has been revisited for further code size reduction.
New API skMinTrackSizeX ();
return the minimum width size of main window once skinned.
New API skMinTrackSizeY ();
return the minimum height size of main window once skinned.
New API skUseThisBackground(IN HWND hWnd, IN WCHAR* zItem);
To change on the fly the wallpaper background without using the top left icon,
even when the .sks parameter is disabled "BACKGROUNDPATH,      resource\Background"
The skInitEngine API has an extra optional parameter:
skInitEngine (IN WCHAR* zSkinFile, IN WCHAR* zUserKey, IN HWND hParent);

GDImage 7.16
Is an experimental version converted to VS2022, with a new API named "ZD_GLtoBitmap" to dynamically turn the OpenGL context into a ZOBJECT sprite bitmap (see the RenderAnimation() procedure).


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


   
* procedural programming mode, is based on direct use of the FLAT API (Windows SDK) that is the core meat of the OS.
33
The concept / Re: Tutor_14 (C++ VS2022 GDImage64 tutorial)
« Last post by Patrice Terrier on August 27, 2023, 09:25:06 am »
Quote
Can you change the IN parameters of WCHAR* type to const WCHAR* type? Windows API uses LPCWSTR which is the same as const WCHAR*

I did try to use const WCHAR*, but that is causing too much havoc into the GDImage64.dll.
Especially when a IN parameter is changed inside of the code for internal uses.

In my code IN means, this parameter is not returned to the calling code, however it could be altered for internal purpose.
In other world, IN doesn't mean it is a const parameter.

The "IN" and "OUT" macros are doing nothing, they are just used for informational purpose.
34
The concept / Re: Tutor_14 (C++ VS2022 GDImage64 tutorial)
« Last post by Shao Voon Wong on August 27, 2023, 08:33:37 am »
Thanks for removing the .vs folder because I had problems opening the Tutor solution as your .vs point to path of project files on your machine which are different from mine. I always have to delete .vs folder before opening the solution to avoid the opening problem. .vs is to store the intellisense information which can be regenerated.
35
The concept / Re: Tutor_14 (C++ VS2022 GDImage64 tutorial)
« Last post by Shao Voon Wong on August 27, 2023, 08:25:49 am »
Thanks Patrice,

Can you change the IN parameters of WCHAR* type to const WCHAR* type? Windows API uses LPCWSTR which is the same as const WCHAR*

For example, change from

Code: [Select]
C_IMPORT WCHAR*    ZI_SetSaveExtension (IN WCHAR* sExtension, IN long RW);
to

Code: [Select]
C_IMPORT WCHAR*    ZI_SetSaveExtension (IN const WCHAR* sExtension, IN long RW);
You also have to change in the original source code of GDImage and build a new version of GDImage64.dll.

Thanks.
36
The concept / Re: Tutor_14 (C++ VS2022 GDImage64 tutorial)
« Last post by Patrice Terrier on August 27, 2023, 08:14:08 am »
Here is the Debug version, without the .vs hidden folder.

About the correct Debug settings, open the "Project" --> "Properties" to figure what to do.
The important parts are in these sections
> C/C++
> Linker
 Starting from now,, I shall try to add a Debug version in new tutors.

However keep in mind that the settings for Debug and Release are very different.

Have a look at these settings to produce standalone EXE without using the CRT.
http://www.objreader.com/index.php?topic=335.msg6044#msg6044
37
The concept / Re: Tutor_14 (C++ VS2022 GDImage64 tutorial)
« Last post by Shao Voon Wong on August 27, 2023, 03:05:10 am »
Sorry I am unsure to understand your concern.
Do you want to build a 32-bit version of Tutor_14 in debug mode?
But what about the GDImage DLL that is 64-bit...

The first thing would be to create a 32-bit version of GDImage working only in ANSI rather than UNICODE.
This is exactly what the old PowerBASIC version does.
Or do you want to have a 32-bit UNICODE version ?

Or you just want to have a 64-bit version of Tutor_14 working in debug mode ?

In that case, I would want 64-bit version of Tutor_14 working in debug mode since I only have 64-bit GDImage. Please show me the relevant settings to make it compilable in 64-bit debug so that I'll know how to do it when I start a new GDImage project.

And can you kindly remove the hidden .vs folder from the source code since that .vs contains regenerated info whenever the solution is opened? And that .vs only contains info relevant to your dev machine which is not useful to me.

Thanks in advance.
38
The concept / Re: Tutor_14 (C++ VS2022 GDImage64 tutorial)
« Last post by Patrice Terrier on August 26, 2023, 09:59:37 am »
Currently in GDImage the WCHAR constants are defined like this

Code: [Select]
static WCHAR*   $NULL               = L"";
static WCHAR*   $SPACE              = L" ";
static WCHAR*   $CHARNULL           = L"\0";
static WCHAR*   $COMMA              = L",";
static WCHAR*   $ANTI               = L"\\";
static WCHAR*   $DOT                = L".";
static WCHAR*   $SAVE_EXT           = L"PNG,JPG,BMP,TIF,GIF,EMF,WMF";
static WCHAR*   $FILTER             = L"*.PNG (Portable Network Graphic)|*.PNG|*.JPG (JPEG File Interchange)|*.JPG;*.JPEG|*.BMP (Windows Bitmap)|*.BMP|*.TIF (Tagged Image File)|*.TIF;*.TIFF|";
static WCHAR*   $JPG_PNG            = L"JPG,PNG";
static WCHAR*   $ZLIM               = L"|";
static WCHAR*   $LF                 = L"\n";
static WCHAR*   $RegistryKey        = L"SOFTWARE\\GDImage";
static WCHAR*   $RegistryPath       = L"LoadDefaultPathName";

const int SCROLLBAR_NONE     = 0;
const int SCROLLBAR_VERT     = 1;
const int SCROLLBAR_HORZ     = 2;
const int SCROLLBAR_BOTH     = 3;

const int CHECK_FOR_MULTISAMPLE     = TRUE;
const int WGL_SAMPLE_BUFFERS_ARB    = 0x2041;
const int WGL_SAMPLES_ARB           = 0x2042;
const int WGL_DRAW_TO_WINDOW_ARB    = 0x2001;
const int WGL_SUPPORT_OPENGL_ARB    = 0x2010;
const int WGL_ACCELERATION_ARB      = 0x2003;
const int WGL_FULL_ACCELERATION_ARB = 0x2027;
const int WGL_COLOR_BITS_ARB        = 0x2014;
const int WGL_ALPHA_BITS_ARB        = 0x201B;
const int WGL_DEPTH_BITS_ARB        = 0x2022;
const int WGL_STENCIL_BITS_ARB      = 0x2023;
const int WGL_DOUBLE_BUFFER_ARB     = 0x2011;
39
The concept / Re: Tutor_14 (C++ VS2022 GDImage64 tutorial)
« Last post by Patrice Terrier on August 26, 2023, 09:45:30 am »
Sorry I am unsure to understand your concern.
Do you want to build a 32-bit version of Tutor_14 in debug mode?
But what about the GDImage DLL that is 64-bit...

The first thing would be to create a 32-bit version of GDImage working only in ANSI rather than UNICODE.
This is exactly what the old PowerBASIC version does.
Or do you want to have a 32-bit UNICODE version ?

Or you just want to have a 64-bit version of Tutor_14 working in debug mode ?

40
The concept / Re: Tutor_14 (C++ VS2022 GDImage64 tutorial)
« Last post by Shao Voon Wong on August 26, 2023, 09:02:41 am »
Hi Patrice,

I cannot build in debug x64 x86 build and release x86 build of your Tutor 14. There are some errors and many errors due to the invalid WCHAR* conversion. If I try out to write some GDImage code, I am not going to start from scratch; I am going to take your existing Tutor 14 code and remove the code which I do not need to write a zooming photo viewer application. I must be able to debug using the debug build when something goes wrong. Right now, I am unable to build a debug build.

In 1990s, using Turbo C. I was able to write something like

Code: [Select]
char* text = "Good Holidays";
Starting from the early 2000s, I was not allowed to do this. A const keyword must be used.

Code: [Select]
const char* text = "Good Holidays";
For example, given the MyFunction below

Code: [Select]
void MyFunction()
{
    char* text = "Good Holidays";
    // code that modifies the content which text is pointing to.
}

If MyFunction modifies "Good Holidays" which is a static memory area, then the next time, MyFunction is called again, the text won't be "Good Holidays". This is why const must be used for string literals. I never verify if this is true because it is an industry practice that every C/C++ developer and I has to follow.

Assigning char* to const char* is allowed.

Code: [Select]
char* text = ???
const char* text2 = text; // allowed

but the opposite is not allowed by the compiler.

Code: [Select]
const char* text = ???
char* text2 = text; // error: not allowed.

Can you modify all the in parameters of WCHAR* to const WCHAR* in GDImage? This is to cut down the compile errors I have to fix when compiling in debug build. The side effort of this modification is you cannot modify const WCHAR* argument inside your function.

What do you think?
Pages: 1 2 3 [4] 5 6 ... 10