Forum > Windows

Compile resource files for a WINAPI window by means of Lazres

(1/3) > >>

Pieter:
For Windows 11, on a 64-bit laptop, I used Lazres to recompile the resource files for the WINAPI application in GetClientRect in:

https://forum.lazarus.freepascal.org/index.php/topic,52902.msg390865.html#msg390865, see also the attachment

I called Lazres in the following way (compilation of the resources in Lazarus did not work, input file could not be found)

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---lazres GetClientRect.RES GetClientRect.rc APPICON.ICO
with GetClientRectangle.rc:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---#include "resource.pas" APPICON                 ICON                        "APPICON.ICO" APPMENU                 MENU  BEGIN    POPUP "&File"      BEGIN         MENUITEM "E&xit"                        ,   IDM_EXIT      END     POPUP "&Help    "      BEGIN         MENUITEM "&About  GetClientRect ..."    ,   IDM_ABOUT      END  END ABOUTBOX DIALOG 42, 20, 170, 90STYLE DS_MODALFRAME | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENUCAPTION "About GetClientRect"FONT 8, "MS Sans Serif"BEGIN  ICON              "APPICON", -1, 10, 10, 32, 32  LTEXT             "Win32 API Example - Functions", -1, 35, 10, 170, 10  LTEXT             "GetClientRect", -1, 35, 20, 170, 10  CTEXT             "Copyright \251 1997  440bx",-1, 1, 40, 170, 10  CTEXT             "All rights reserved.", -1, 1, 48, 170, 10  DEFPUSHBUTTON     "OK", IDOK, 60, 67, 50, 14END  
and the implied Resource.pas file


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit resource;  { resource IDs for the GetClientRect example                                } {-----------------------------------------------------------------------------}INTERFACE{-----------------------------------------------------------------------------} const IDM_EXIT        = 900;  IDM_ABOUT       = 990; {-----------------------------------------------------------------------------}IMPLEMENTATION{-----------------------------------------------------------------------------} end.
To my surprise, the icon is incorporated in the program but the menus are not. What is is happening here? I'd be happy to know so I can use the procedure for other applications requiring resource compilation



440bx:
I've seen that problem before.  It's related to the fact that Lazarus manages resource and resource files a bit differently.

Have a look at this thread: https://forum.lazarus.freepascal.org/index.php/topic,40830.msg282333.html#msg282333

the solution/explanation is quite likely there.

Thaddy:
You should not even need to call LazRes. The compiler will do that for you..... Only if you change the rc file you will need a rebuild for the whole program.

Pieter:

--- Quote from: Thaddy on August 02, 2022, 09:48:44 pm ---You should not even need to call LazRes. The compiler will do that for you..... Only if you change the rc file you will need a rebuild for the whole program.

--- End quote ---

This was what I expected but I get the following error message, in addition to two warnings

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Error while compiling resources -> Compile with -vd for more details. Check for duplicatesWarning: windres [option(s)] [input-file] [output-file]windres: supported targets: pe-i386 pei-i386 elf32-i386 elf32-iamcu elf32-little elf32-big pe-x86-64 pei-x86-64 pe-bigobj-x86-64 elf64-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big plugin srec symbolsrec verilog tekhex binary ihex 
That's why I used the Lazres separate compilation but with the problem mentioned above.

Pieter:

--- Quote from: 440bx on August 02, 2022, 06:18:48 pm ---I've seen that problem before.  It's related to the fact that Lazarus manages resource and resource files a bit differently.

Have a look at this thread: https://forum.lazarus.freepascal.org/index.php/topic,40830.msg282333.html#msg282333

the solution/explanation is quite likely there.

--- End quote ---

I did have a look a the thread but renaming the resource file with a name different from the program does not have an effect.
That is, if I do:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---lazres JustAResource.RES GetClientRect.rc APPICON.ICOand include the RES file in the source program, the implied resources (i.e. the menu's) do not show up.
I wonder if I did apply Lazres correctly. What could be the matter?

Navigation

[0] Message Index

[#] Next page

Go to full version