Home > Enterprise >  How to insert multi-size icon file using RC.EXE?
How to insert multi-size icon file using RC.EXE?

Time:11-29

I created a multi-sized icon file for my application. Now i'm using a .rc file to link the icon to my app. Here is the contents of my .rc file :

MAINICON ICON myapp.ico

The file is compiled by RC.EXE, but no icon is added into my application; it keeps using the default Delphi's icon :

enter image description here

What am i missing ?

Thanks

CodePudding user response:

The icon you specify in your *.rc file does indeed get included in the EXE, as you can easily verify using a resource editor. However, if you build using the IDE, so does the icon specified in the Project Options, and that one becomes the main icon of the application.

I almost would expect the Project Options dialog box to have some option not to include an icon, but I cannot find any such option. You can add or change the icon, but you cannot remove it if it is already there.

However, it seems like you can remove it yourself by editing the *.dproj file behind the back of the IDE:

  1. Make sure the project is NOT opened in any instance of the Rad Studio IDE.
  2. Open the *.dproj file in a text editor.
  3. Remove the <Icon_MainIcon> line(s).
  4. Save the file.

Now, if you open the project in the IDE and build it, the IDE will not insert any icon, so your icon specified in the *.rc file becomes the application icon.

  • Related