Recent

Author Topic: Recreate RES file  (Read 305 times)

Paolo

  • Hero Member
  • *****
  • Posts: 639
Recreate RES file
« on: November 03, 2025, 04:17:00 pm »
Hello,
If I am not wrong using Delphi, in case of missed RES file, I received a message like "missed resiurce file, res file recreated". Now I have converted some delphi app without RES file, but fpc/laz just say "missed res file" then I am stuck. How can recreate the res file ?
All the above if I am not wrong about Delphi behaviour.... but in general what can I do if res file is missed in laz/fpc ?
Thanks a lot for suggestions.

Thaddy

  • Hero Member
  • *****
  • Posts: 18304
  • Here stood a man who saw the Elbe and jumped it.
Re: Recreate RES file
« Reply #1 on: November 03, 2025, 05:07:27 pm »
A missing resfile can - even by delphi - only be recreated if:
a: a default res file (contains only a default application icon) or
b: the presence of a resource script, a rc file, which is text.

If b: is not there, simply comment out {$R *.res} because you don't need it in that case.

You can also simply add an application icon in the project settings in Lazarus. Which will create a:
« Last Edit: November 03, 2025, 06:10:18 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12523
  • FPC developer.
Re: Recreate RES file
« Reply #2 on: November 03, 2025, 05:35:12 pm »
Like Thaddy says, not all RES files are auto generated. The first step is what kind of resource file is missing.

There is an autogenerated global application resource file with icon and manifest, and a .res for each form. Also .rc files can be added to the project to be auto generated on compile (with fpcres/windres).

Third party files are often duplication of manifest relating settings, specially if the source was meant for older Delphi versions like D6 or D7.

So to start, is the resource file either the name of the application or a form ? If not, we need to find where it is referenced.

Paolo

  • Hero Member
  • *****
  • Posts: 639
Re: Recreate RES file
« Reply #3 on: November 06, 2025, 07:06:07 pm »
yes it is the res (res) file with the same name of project (lpr) .

I see that if I delete such res file Laz-fpc silently recreate it.

So the problem is about delphi to fpc traslation (the delphi version doen't have res file). I followed the Thaddy suggestion and apply the stadard icon to the project, now a res file is created, but now I have other issue to be understand (unfortunately the dfm file is a binary file).

thanks

wp

  • Hero Member
  • *****
  • Posts: 13195
Re: Recreate RES file
« Reply #4 on: November 06, 2025, 07:14:59 pm »
unfortunately the dfm file is a binary file
The Delphi converter built into Lazarus should convert this automatically. Or you can convert it binary to text dfm manually by "Tools" > "Delphi Conversion" > "Convert binary dfm to lfm".

Important advice: Always make a backup copy of your delphi project before attempty any conversion.

Paolo

  • Hero Member
  • *****
  • Posts: 639
Re: Recreate RES file
« Reply #5 on: November 06, 2025, 08:10:13 pm »
Thanks, I'll try it.

 

TinyPortal © 2005-2018