in reply to Re^7: Can't change icon with win32 module
in thread Can't change icon with win32 module
I don't see how that is important, $^E is just four clicks away, always there, needs no use lines or nothing
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^9: Can't change icon with win32 module
by palkia (Monk) on Sep 24, 2012 at 03:50 UTC | |
At this version it says for box2.ico as well as for zzz.pl (instead of box1.ico) it says The practical difference between the 3 is that only box1.ico is showed, the other 2 don't change the icon. When I target a non-existing file, it says It seems to me that Win32::GUI::Icon->new('box1.ico') is just undef when used on box2.ico as well as for zzz.pl. | [reply] [d/l] [select] |
by Anonymous Monk on Sep 24, 2012 at 04:48 UTC | |
Here is mine
Obviously sicon.pl isn't an .ico file Looking at these results and Win32::GUI::Icon docs, it is now obvious that it doesn't preserve $^E from the 2-3 ways it tries to load the file, so $^E ends up being uninformative FormatMessage() OTOH assumes 0 means success where as $^E doesn't
Since this program works for me for about a dozen icon files I find in program files I must assume there is something wrong with your box2.ico good luck figuring it out :) You might hack on some GUI.xs to insert informative diagnostics, or hit up MSDN for specs regarding icon files so you can compare them to box2.ico ... | [reply] [d/l] |
by bulk88 (Priest) on Sep 24, 2012 at 20:38 UTC | |
"eval{SetConsoleIcon( Win32::GUI::Icon->new('box1.ico')->{-handle});}; #eval 2 counter the die from undef return from "new" with "->"" duh! If Win32::GUI::Icon returns undef, dont deref or meth call on it. I'm not sure if the print() corrupts GLR or not. SetConsoleIcon is irrelevant to call if you didn't create an Icon handle in the first place. AM is correct, you probably dont have a valid ico file. If you really want to know the GLR error, use a C debugger and step through GUI.xs, or use Win32::API to call User32.dll LoadImage directly. You can also post box2.ico (do a binmode and use Data::Dumper to turn the ico file into a escaped string literal) and I see if it loads on my system and why GUI::LoadImage fails. | [reply] [d/l] |
In Section
Seekers of Perl Wisdom