This mini guide will take you through the steps that I go through when I add 
bitmaps, binary objects and an XP manifest to my exe. These steps should work 
with perl2exe and perlapp.

I have tried to make these steps as simple as possible, I apologies in advance 
if this approach turns out to be too simplistic:) If you have any questions, or 
comments, please email me.

Before you start:

To edit/add any resource to an exe you need to use a tool of some sort - these 
steps use Resource Hacker, a freeware utility. 

http://www.users.on.net/johnson/resourcehacker/

Manually Adding your resources:

1) Generate your exe as normal
2) Start Resource Hacker and open your exe.
3) To add any resource, use  Action->Add a new resource from the main menu.
For bitmaps, icons and cursors, the resource type will be filled for you. Just 
type the name of the resource and click ok (all names are upper case).
For binary objects, the type has to be "RCDATA".
For the XP manifest, the type has to be "24" and the name has to be "1". The 
length of the XML file should be multiple of 4 (just pad with spaces).
4) Save you changes.

To retrieve binary objects at runtime use Win32::GUI::LoadResource. Bitmaps, 
Cursors and icons will be retrieved automatically (assuming the name matches). 
You will need to include logic in your application to handle the situation 
where your application is run direct with perl.

Automating:

Clearly adding resources every time you regenerate your exe would become a 
pain, however you can save your resources to a res file and add them with the 
command line options of reshacker.

1) Start Resource Hacker and open your exe which you have added resources
2) Create the res file, use File->Save As, change the type to *.res and save 
the res file as the same name as your exe.
3) Use the following command to add resources to every freshly generated exe:

reshacker.exe -addoverwrite yourapp.exe,yourapp.exe,yourapp.res,,,

(The three comma's in the above command are required).











Reply via email to