in reply to Re^9: Can't change icon with win32 module
in thread Can't change icon with win32 module
"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.use strict; use warnings; use Win32; use Win32::GUI(); use Win32::API; Win32::API->Import('kernel32','BOOL SetConsoleIcon(HWND icon)'); eval{SetConsoleIcon( Win32::GUI::Icon->new('box1.ico')->{-handle});}; +#eval 2 counter the die from undef return from "new" with "->" print 0+$^E; print " ---\n".'$^E = '; #separated \n just in case print $^E; print " ---\n".'$! = '; print $!; print " ---\n".'$@ = '; print $@; print " ---\n".'FormatMessage = '; print Win32::FormatMessage(Win32::GetLastError()); sleep 50; exit;
|
|---|