- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Surely there is an easy way to do this.
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
(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.)
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.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The resource compiler does come with the shell and should be invoked automatically if you add a .rc file to the project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try using this instead of what Ian showed:
FRAMEICON ICON "myicon.ico"
FRAMEICON ICON "myicon.ico"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works! Thanks again.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page