Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^10: Can't change icon with win32 module

by bulk88 (Priest)
on Sep 24, 2012 at 20:38 UTC ( #995439=note: print w/ replies, xml ) Need Help??


in reply to Re^9: Can't change icon with win32 module
in thread Can't change icon with win32 module

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;
"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.


Comment on Re^10: Can't change icon with win32 module
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995439]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2014-12-27 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls