Its me again, some code for you
#!/usr/bin/perl --
#~ wget -c -O perlmonks.favicon.ico http://perlmonks.org/favicon.ico
use strict; use warnings;
use Data::Dump;
use Win32::GUI();
my $icon = 'Win32::GUI::Icon'->new(
'perlmonks.favicon.ico'
) or die $^E;
my $cmd = Win32::GUI::GetPerlWindow() or die $^E;
dd [ $cmd, $^E ];
dd [ Win32::GUI::ChangeIcon($cmd, $icon) , $^E ]; ## "Access is denied
+" as expected
BEGIN {
use Win32::API;
Win32::API::->Import("kernel32","BOOL SetConsoleIcon(HWND icon )")
+;
}
$^E=0; dd [ SetConsoleIcon( $icon->{-handle} ), $^E ]; ## UNDOCUMENTED
+ MAGIC
__END__
[46334276, ""]
[0, "Access is denied"]
[1, ""]
SetConsoleIcon() naturally works where ChangeIcon() fails