Goody Gumdrops.
Just committed a change to CVS so that icons, bitmaps and cursors created in
the standard way are first checked for in the EXE file that loaded Win32::GUI.
Now there are some little points of note:
1. Doesnt work with PAR (unless you're a sneaky bugger). The reason it doesnt
work with PAR is because PAR is just a self-extracting archive that auto-runs a
perl interpreter on extraction. If you want to compile-in resources with PAR
you'll need to add the resources to whatever interpreter executable it puts
inside it's archive (looks like it's par.exe) rather than the exe file actually
generated by PAR.
2. If I play around with perl2exe-generated executables in ResHacker, they
either crash or fail to even start. This might be some sort of "don't you hack
me!" protection inside the evaluation version of perl2exe, but it seems odd.
3. Not tried it with perlapp, I hope it works with this.
4. When adding resources with ResHacker, give the resource the same name as you
passed for the filename of new Win32::GUI::Bitmap/Icon/Cursor. For instance, if
you're doing new Win32::GUI::Bitmap("two.bmp") then your resource should have
the name "TWO.BMP".
I had to test this by ResHackering my perl executable. Hopefully someone out
there has shelled out for perl2exe full version or perlapp, and if that's the
case then please test this on those two tools to see if it works.
Feedback please.
Steve
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jez White
Sent: 19 February 2004 09:46
To: Steve Pick; Win32-GUI
Subject: Re: [perl-win32-gui-users] Shipping resources with your exe
I agree with your analysis - I especially like the idea of bitmaps, Icons and
cursors to check for resources first, and then to look at the file system
(would solve the problem of running in "dev" mode with the perl command line,
or running the exe direct).
How easy would it to be load other binary objects in from the exe? For example,
having other image formats or storable created objects.
As for adding resources - I can see the benefits of having a native solution,
but it would create massive scope to mess around with the perl exe:) Perhaps
the first step is to point to ResHacker, with a step by step guide on how to
use it?
jez.
----- Original Message -----
From: Steve Pick <mailto:[EMAIL PROTECTED]>
To: Jez White <mailto:[EMAIL PROTECTED]> ; Win32-GUI
<mailto:[email protected]>
Sent: Wednesday, February 18, 2004 10:40 PM
Subject: Re: [perl-win32-gui-users] Shipping resources with your exe
I'd find this functionality kinda handy. Loading resources from the exe is very
simple, and it would not be too difficult to extend the Win32::GUI::Bitmap,
Icon, etc. objects to accept an additional argument that indicates that the
resource should be loaded from the exe rather than from a real file on disk (in
fact, it would actually be a trivial matter to do this).
What is less trivial is getting the resources in there in the first place.
While ResHacker lets you do it, it'd be nice to see a Win32::GUI native way of
doing it. Microsoft provides functions for adding, deleting and replacing
resources in executable files and I propose we either:
1. Add this update/add/delete functionality into Win32::GUI so that
applications can fiddle with their own resources. This may be an exceptionally
bad idea (what exe file will it think it's using when running straight from
Perl? We dont want it messing with perl.exe's resources)
2. Create a small tool that is distributed with Win32::GUI to pack resources
into the exe. I doubt we can re-dist ResHacker with win32::gui and it'd be nice
if there was this functionality provided. The Win32::GUI::Bitmap, Icon and
Cursor objects could then be modified to first check for a resource identified
by the given filename in the current running exe, and if it's not found attempt
to use the given filename to load an external file. This seems the best mode of
operation to me.
Steve
----- Original Message -----
From: Jez White <mailto:[EMAIL PROTECTED]>
To: Win32-GUI <mailto:[email protected]>
Sent: Wednesday, February 18, 2004 6:34 PM
Subject: [perl-win32-gui-users] Shipping resources with your exe
Hi,
One the problems I have when I ship my exe is ensuring that all the resources
(bitmaps, cursors and config files) are valid when my app starts up. Typically,
just including them in a sub directory can cause problems since the user could
delete or alter them. The ideal solution would be to package the resources into
the exe and extract them at runtime. See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Resources.asp
Adding the resources to the exe is quite straightforward (with reshacker) but
I'm not sure how easy it would be to implement these function calls (or even it
is possible), would anyone find this kind of functionality useful?
Cheers,
jez.