Home > Blockchain >  How to get multiple icon file into Delphi resource file
How to get multiple icon file into Delphi resource file

Time:11-29

I'm trying to generate a multi-size icon file to my Delphi app, so Windows will choose the best size to show in each situation.

Following the official support instructions at https://docwiki.embarcadero.com/RADStudio/Sydney/en/Creating_and_Deploying_App_Icons

Storing Your Icon Files into an Icon Container Once you have your app icon in all the resolutions that a target platform requires, for desktop platforms you must then archive the different resolutions of your icon into a single file, an icon container, that you can deploy along with your application.

For Windows, you must create an .ico icon container file. See How to make/get a multi size .ico file?."

It directs to this Stack Overflow question :

How to make/get a multi size .ico file?

I followed the instructions exactly as described and could get a multi-size icon file using ImageMagick.

Problem is , when i try to compile my resource file using BRCC32, i get this error :

[BRCC32 Error] icon.rc(2): Allocate failed

Here is the contents of my RC file :

LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
MAINICON icon "myapp.ico"

If i go to Project > Application > Icons, i can load the myapp.ico without problems, but due to the nature of my project, i need to use a resource file instead.

Please help, i'm stuck on this issue for days.

Thanks

CodePudding user response:

From the documentation on resource compilers:

Both C Builder and Delphi give you a choice of resource compilers. On the Project > Options > Resource Compiler dialog box, you can select either of the following:

  • BRCC32.exe, the C Builder resource compiler
  • RC.exe, the Microsoft platform SDK Resource Compiler

RC supports Unicode characters in resource files and file names, as well as new Vista resource types such as icons with alpha channel.

Hence, if you need Vista icons, you need to change to the RC compiler.

  • Related