Hi,

I use Wx quite a bit and I would always just use --addfile for icons and 
resources.

I think your problem is that you are getting your executable path from the 
wrong source.

As I recall, $0 will always give you the relative path to the exec you created 
with pp, so it is this one you want to grab the icons from if you prefer the PE 
resource route.

Regards

Mark
John wrote:
Mark Dootson wrote:
Hi,

Check out the source code for

Win32::Exe
Win32::Exe::IconFile
Win32::Exe::Resource::Icon;
Win32::Exe::Resource::GroupIcon;

Instead of specifying '-icon' as a param to pp, you should be able to figure out how to add icons with specific id's after you have built the exec.

untested, but looks something like following should work:

# get icons from an iconfile

my @icons = Win32::Exe::IconFile->new($iconfile)->icons;
# @icons = array of Win32::Exe::Resource::Icon objects
# reorder @icons setting Id of each one

my $exe = Win32::Exe->new($execfile);

$exe->set_icons([EMAIL PROTECTED]).

To repeat, untested so the correct approach may not be exactly as above.


Mark

Thank you Mark

This idea is something I will follow up on because I think it is a way of automating what I am doing manually with a resource editor at the moment and I need to understand what is happening better, but I don't think it will address my original issue.

I had two issues that I was trying to solve with a common solution.

1. I wanted a particular icon in the executable package file so that it would display on the desktop, explorer etc. --icon, the methods you indicate above or a resource editor can facilitate this.

2. I wanted the same icon to appear in my apps window title bar. I was trying to extract the icon from the executable that was processing my script, believing it to be (or to have inherited the icon from) the executable package, and could not find the one I wanted. Digging deeper reveals this is not the case. For now, my workaround is to use --addfile to include my icon file in the package.





John wrote:
Philippe Schaffnit wrote:
Hi!

I haven't managed either exactly what you are attempting (though I would
be really interested!), but a fairly painless workaround (which I
actually use), is to pack the icon additionally with '--addfile', and
get it from there afterwards (it's messy, but the file is tiny
anyway...).

Good luck!

Philippe
Thank you Phillipe

I eventually came up with that idea as well. May be someone else will chip in with a response and we will both learn something new.

John


John wrote:
Hi

I am packaging a Win32::GUI app with:

pp -i myicon.ico -M Math::Trig -M Win32::GUI -M Win32::GUI::Grid -g -o
b.exe guess1.plw

in my app Iam using:

my $icon = new Win32::GUI::Icon(105);
$main->ChangeIcon($icon);

to access and set my apps title bar icon. Looking in the packaged app
with a resource editor myicon appears as 101. When I use that number in the statement above (currently 105) I get a camel. Changing that number
I get a variety of other icons but not the one I want.

Could someone please suggest how I might achieve what I want and
possibly explain what is happening. As I write this I think that the
camel icon is coming from parl.exe which I understand to be part of the
executable component of the package.

--
Regards
    John McMahon
         [EMAIL PROTECTED]












Reply via email to