User forums > Using Code::Blocks

icons into the exe

(1/2) > >>

MoonKid:
How can I compile icons (png, ico, ...) in the exe file, so that the binary is shown with this symbol instead of the standard-win32-exe symbol?

MortenMacFly:
Create a resource file and name the first (your) icon resource "AAAAAAAAAAEXEICON". (No, these awful "A"'s are not an error.) Thus you "place" this icon to be the first resource. Windows will pick the first resource as icon for the executable. Make sure you add the resource file to your project so that it's being compiled / linked... ;-)

MoonKid:
Nice it works.

Which format need this icon to have. This time I use a 16x16 ICO file.

But what is about a bigger view?

MortenMacFly:

--- Quote from: MoonKid on April 27, 2008, 06:28:47 pm ---But what is about a bigger view?

--- End quote ---
An icon file can actually hold more than one icon in several resolutions (16x16, 32x32, 64x64...) and several color depths. You can use tools like IcoFX (http://icofx.ro/) to create such "combined" icon files. Windows is so clever - it will choose just the right resolution/color depth at runtime which depends on the resolution / color depth of the OS on the target machine (obviously).

Although such "cleverness" I found no way to tell Windows *not* to take the first resource as application icon. :? That's why I suggested "AAAAA..." in front. If you find a "right" solution - step forward. ;-)

Jeisson:
Morten. Can those icon files be used only with MsWindows?. When I compile the project in Linux, they generate non-fatal runtime errors and finally they are not shown. Should I generate both, .ico (for .rc file) and xpm files in any other place (frames, menus...)?

A derivated question. How can I skip compiling the .rc file under Linux?

Thanks a lot for your kindness.
Best regards.

Navigation

[0] Message Index

[#] Next page

Go to full version