public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* How to embed icon for the executable
@ 2002-10-09 19:44 Michael Foo
  2002-10-10  1:14 ` Rupert Wood
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Foo @ 2002-10-09 19:44 UTC (permalink / raw)
  To: gcc-help

Hi everyone,

  I am using Cygwin on Windows ME. After "gcc -o foo.exe foo.c", 
it create a default windows icon for foo.exe. However, I wish to 
replace the icon with another icon (.ico) which I downloaded from 
the internet. Any clue or help how to add this .ico file to my 
executable?

  Thank you :)

Regards
Michael

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to embed icon for the executable
  2002-10-09 19:44 How to embed icon for the executable Michael Foo
@ 2002-10-10  1:14 ` Rupert Wood
  0 siblings, 0 replies; 2+ messages in thread
From: Rupert Wood @ 2002-10-10  1:14 UTC (permalink / raw)
  To: Michael Foo; +Cc: gcc-help

Michael Foo wrote:

> I am using Cygwin on Windows ME. After "gcc -o foo.exe foo.c", it create
> a default windows icon for foo.exe. However, I wish to replace the icon
> with another icon (.ico) which I downloaded from the internet. Any clue
> or help how to add this .ico file to my executable?

I've never done this with cygwin but the basic process is:

    1. write an .rc file (resource script)
    2. compile the .rc and the .ico into a .res
    3. link the .res into your .exe

You can find documentation for .rc files in the online MSDN library

    http://msdn.microsoft.com/library/en-us/tools/rc_6cs3.asp

and you want something like:

    LANGUAGE 0, 0
    100     ICON    filename.ico

By default, the shell uses the first icon it finds; traditionally, the
lowest resource number used is ID 100. If you need to access this from
your program, you usually create a file 'resource.h' which #defines
IDI_MAINICON 100 or similar and then #include this in the resource script.
Rather than 0,0 for the language ID (LANG_NEUTRAL, SUBLANG_NEUTRAL) you
can #include <windows.h> and use

    #include <windows.h>
    LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
    100     ICON    filename.ico

You then compile this to a .res using a resource compiler; I think there's
one in binutils called 'windres' or similar which you should have already
installed. Alternatively, you can download the Microsoft Platform SDK

    http://www.microsoft.com/msdownload/platformsdk/sdkupdate/

and use Microsoft's own, rc.exe.

Then, finger's crossed, you just add the .res to the compile / link line
and the linker takes care of the rest.

Good luck,
Rup.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-10-10  8:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-09 19:44 How to embed icon for the executable Michael Foo
2002-10-10  1:14 ` Rupert Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).