From: Stephen P. <Ste...@uc...> - 2004-02-19 11:10:16
|
Goody Gumdrops. =20 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: =20 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. =20 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. =20 3. Not tried it with perlapp, I hope it works with this. =20 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". =20 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. =20 Feedback please. =20 Steve =20 -----Original Message----- From: per...@li... = [mailto:per...@li...]On 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).=20 =20 How easy would it to be load other binary objects in from the exe? For = example, having other image formats or storable created objects. =20 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? =20 jez. =20 =20 ----- Original Message -----=20 From: Steve Pick <mailto:st...@ba...> =20 To: Jez White <mailto:je...@je...> ; Win32-GUI = <mailto:per...@li...> =20 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). =20 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: =20 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) =20 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. =20 Steve ----- Original Message -----=20 From: Jez White <mailto:je...@je...> =20 To: Win32-GUI <mailto:per...@li...> =20 Sent: Wednesday, February 18, 2004 6:34 PM Subject: [perl-win32-gui-users] Shipping resources with your exe Hi, =20 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:=20 =20 http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/winui/= WinUI/WindowsUserInterface/Resources.asp =20 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?=20 =20 Cheers, =20 jez. |