The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: The Rogue on July 19, 2008, 11:28:08 PM

Title: How Do You Add An Icon?
Post by: The Rogue on July 19, 2008, 11:28:08 PM
How would I add an icon to a MASM project? Someone said something about resource script files? Can anyone point me in the right direction?

Thanks.
Title: Re: How Do You Add An Icon?
Post by: hutch-- on July 19, 2008, 11:36:15 PM
Rogue,

Create the icon then use a resource editor to add it into the project. hen you use the Windows API LoadIcon() or LoadImage() to get a working handle to it and display in where you need.
Title: Re: How Do You Add An Icon?
Post by: The Rogue on July 19, 2008, 11:43:23 PM
I dont want to display the icon. I want it to be for the exe itself.
Title: Re: How Do You Add An Icon?
Post by: PBrennick on July 19, 2008, 11:54:52 PM
Rogue,
Just load it using the resource script. You do not need to add any instructions in the assembly source file if that is all you want to do. When the project is built, the exe will use the icon, on the desktop, for example. I have included an example from the GeneSys Project to show you how it is done.

[attachment deleted by admin]
Title: Re: How Do You Add An Icon?
Post by: Tedd on July 20, 2008, 05:03:14 PM
Simply add the icon as a resource.
Windows will display the 'first' icon as the exe's icon - so make sure it's numerically first (or alphabetically, if you're using string names); not that it matters if you only have one icon :wink

In your .rc file, add the following line:
100 ICON "youricon.ico"
Title: Re: How Do You Add An Icon?
Post by: jj2007 on August 04, 2008, 07:37:49 AM
Quote from: Tedd on July 20, 2008, 05:03:14 PM
Simply add the icon as a resource.
Windows will display the 'first' icon as the exe's icon

Just for curiosity: Is there any way to tell Windows it should use the icon of another file, i.e. not to embed an icon, but rather put a reference only? This works obviously for shortcuts and for registered application files, e.g. the .pdf and .doc show their respective icons.
Title: Re: How Do You Add An Icon?
Post by: Jimg on August 04, 2008, 02:00:53 PM
opps, replied in wrong topic, please delete.