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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|