Delphi 11.1 is not adding my RC file during a build

Viewed 75

I am trying to add additional icons into my project using Delphi 11.1.

I have produced the .rc file with links to the icon files, e.g:

FILES ICON "D:\Documents\Embarcadero\Studio\Projects\Positron Studio\Icons And Images\PositronFiles.ico"
PROJECTS ICON "D:\Documents\Embarcadero\Studio\Projects\Positron Studio\Icons And Images\PositronProjectFiles.ico"

I have added to the .dpr file:

{$R 'PSResource.res' 'PSResource.rc'}

But, on doing a full build, I get messages like this:

[dcc64 Hint] H2161 Warning: Duplicate resource:  Type 14 (ICON GROUP), ID FILES; File D:\Documents\Embarcadero\Studio\Projects\Positron Studio\PSResource.res resource kept; file D:\Documents\Embarcadero\Studio\Projects\Positron Studio\PSResource.res resource discarded.
[dcc64 Hint] H2161 Warning: Duplicate resource:  Type 14 (ICON GROUP), ID PROJECTS; File D:\Documents\Embarcadero\Studio\Projects\Positron Studio\PSResource.res resource kept; file D:\Documents\Embarcadero\Studio\Projects\Positron Studio\PSResource.res resource discarded.

The resulting .res file does not include these extra resources.

I have also tried adding the files directly into the resource file using a Resource Editor. This ensures the resources are in the .exe file, but I cannot access them when I use Icon.LoadFromResourceName(Handle,'NAME'), where Handle is to the open window.

Am I doing something wrong?

EDIT:

I tried using the "Project > Resources and Images" dialog.

I removed all references to the .rc file and the file itself. Added the icons I wanted to add, did a build, and now get an error:

[dcc64 Error] E2161 Error: RLINK32: Unsupported 16bit resource in file "D:\Documents\Embarcadero\Studio\Projects\Positron Studio\PositronStudio.dres"

The icon files comprise RGB/A images at resolutions of 64x64, 48x48, 40x40, 32x32, 24x24, 20x20, 16x16, and RGB 256 at 48x48, 23x23, 24x24, 16x16.

Are any of these unsupported?

I removed and reloaded the icons in "Resources and Images". Tried again and did a full build. The resulting .res file only contains the application icon.

I still get the warning

[dcc64 Hint] H2161 Warning: Duplicate resource:  Type 24 (user-defined), ID 1; File D:\Documents\Embarcadero\Studio\Projects\Positron Studio\PositronStudio.res resource kept; file D:\Documents\tmssoftware\TMS VCL UI Pack\WINXP.RES resource discarded.

I renamed all the WINXP.* files, and removed all references within the project. Now I don't get the warning of duplicate resource files, but the resulting resource file after a full build still doesn't contain the added icons.

Checked in .dproj for .rc and RCCompile, neither were found.

1 Answers

After removing all the superfluous rc and res files I edited the res file to include the additional items I needed then did a build. This time the res file wasn't overwritten by the compiler. They are now embedded in the exe and I can access them in the application.

It has uncovered another issue in that I cannot change the Icon of a form at runtime. I will raise it as separate topic if I cannot find the solution.

Related