Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

How to attach an application icon?

dboggs
New Contributor I
1,974 Views
I need an icon file (*.ico) attached to my application to show in the project frame title bar and, for example, in a desktop shortcut. Normally I would expect this to be handled by Visual Studio, under Application > Properties. Search for help on the internet describes how to do this, but the instructions don't work for my VS2010 (the tab I'm directed to doesn't exist). Is it because the instructions are out of date? Is it because my VS is the shell instead of the complete package? Did I take a wrong fork in the road?

Surely there is an easy way to do this.
0 Kudos
7 Replies
Steven_L_Intel1
Employee
1,974 Views
Because you are using the VS Shell, you do not have the Microsoft Resource Editor which MS will not license to others. You can use the freeware ResEdit as an alternative - this runs outside Visual Studio and gives you the .rc and .h files you will then need to add to your project.
0 Kudos
dboggs
New Contributor I
1,974 Views
Thanks. I knew this VS Shell limit was an issue with designing a dialog, but didn't realize it was the same thing with something as simple as the project icon.

I've taken a quick look at ResEdit and find it imposing, in the sense that I don't need to design a dialog or other fancy things that I'm sure it's quite capable of. All I need to do is stick the name of an ico file somewhere in the project properties list!I don't want to download-install-learn that just to attach an ico file. Perhapssome guru somewhere knows how to do this without going through a resource editor?
0 Kudos
IanH
Honored Contributor III
1,974 Views
(I think the shell comes with the resource compiler, if not you can get it from the Windows [P|S]DK or whatever. Also - I take it that you already have an .ico file.)

All you need is a one line resource script file that references the icon. Something like:

100 ICON "MyIconFilename.ico"

100 will be the MAKEINTRESOURCE(xx) resource identifier for the icon for the relevant API calls when you are creating your windows, etc. I think explorer and friends pick out the lowest numbered icon in the file as the icon to show for the exe or a shortcut.

Create that file with a .rc extension, have it as one of your source files in your VS project alongside your f90 files etc, and, if I understand your requirements correctly (?), you are done!

(The resource compiler (rc.exe) compiles that one line text file to a "binary" xxx.res file. That res file is then bound into the executable by the linker. I think the ifort integration recognises the .rc extension and creates the necessary build rules. Regardless, you can always do the equivalent from the command line post build.)
0 Kudos
Steven_L_Intel1
Employee
1,974 Views
The resource compiler does come with the shell and should be invoked automatically if you add a .rc file to the project.
0 Kudos
dboggs
New Contributor I
1,974 Views
Thanks Ian and Steve for these quick and clear instructions. I am able to easily "attach" my ico file to my Project.exe file!

The icon shows up in the Windows Explorer list, and as a desktop icon when I copy the exe file or a shortcut to the exe file there. However, it does not show up in my project's frame window title bar when it runs (this is a Quickwin project if that matters). This may be pushing the limits of my understanding of icon files. I know they come in different sizes for different uses; the one I have is 32 x 32 x 16 colors. Do I need to make a different type (smaller?) for use in the project title bar? Is there a difference in the resource file for this use?
0 Kudos
Steven_L_Intel1
Employee
1,974 Views
Try using this instead of what Ian showed:

FRAMEICON ICON "myicon.ico"
0 Kudos
dboggs
New Contributor I
1,974 Views

It works! Thanks again.

0 Kudos
Reply