## Embedding Hi-Res Icons & Manifests into Executables A short tutorial by Paul Ludgate aka Zooraptor snakedile@yahoo.com |
If you haven't already got them you need to get a couple of tools to do this. They are both freeware so much respect goes out to their authors. ResHacker from http://rpi.net.au/~ajohnson/resourcehacker to do the embedding. UPX from http://upx.sourceforge.net to unpack and repack the Exe. #### Unpacking The Exe UPX is meant as a console program but there is a GUI available but it's not as flexible as using it from the command prompt when you get to repacking so I'll only deal with using it this way. I am assuming that you have actually bothered to look at the Help file or typed "upx -h" at the command prompt before now. Go to command prompt and unpack your exe with something like:-
Return to Windows. #### Replacing the Application Icon Open ResHacker. In the main menu, go to File > Open > MyApp.exe At the bottom of the left-hand pane fully open the Icon Group branch and click on the cog or number next to it. You should now be looking at something like this.
In the main menu, go to Action > Replace Icon The following dialog appears:-
Click on the 'Open file with new icon' button and navigate your way to your multi-size / multi-resolution icon file and 'Open' it. The new icon will appear on the dialog next to 'Select new icon:' Note that if you have a 32 bit icon in your icon set it be be shown badly but don't worry ResHacker just can't show them properly - it WILL be embedded properly Click the 'Replace' button and you should see something like this:-
In the main menu go to File > Save That's sorted out the icon. Open Explorer and find your file (still unpacked) and use the various views to check out your application's new icon looks. Return to ResHacker.
#### Embedding A Manifest In the main menu, go to Action > Add a new Resource The dialog shown on the right appears. Click on the 'Open file with new resource' button. Navigate your way to a manifest file. It doesn't have to be one you've already prepared - you can use a template and edit in ResHacker. 'Open' the manifest file.
The dialog changes to that shown on the right. The first edit box now shows the name of your manifest file. Fill in the remaining boxes as shown. Resource Type: 24 (This is the ID for manifest) Resource Name: 1 Resource Language: 0 Click the 'Add Resource' Button A new resource appears at the bottom of the left-hand pane. If you fully open its branch, you should now be looking at a screen something like that shown below.
I've added the red arrows to show you the only three lines you might like to edit. The name is supposed to be in the form:- CompanyName.ProductName.ApplicationName The version and description fields are just what they say they are. If you do chose to edit the manifest the 'Compile Script' button will become enabled. When you've finished editing you should click this button. (Note you'll be prompted if you try to save without having compiled so you don't have to remember to do this) In the main menu go to File > Save That's sorted out the manifest. You can try it out now (still unpacked) to make sure it all works. If all is well all we need to do now is repack it.
#### Repacking The Exe We're going to use UPX again so back to the command prompt and enter something like:-
## There all done ! ! !
| I hope this was of some use to you. I actually quite enjoyed putting it together.
#### Paul Ludgate <snakedile@yahoo.com>