http://www.perlmonks.org?node_id=995110


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

Won't seem to go online for me for some reason,
but I just wanted it to use my icons anyway,
so after some tweaking it worked gr8 (thank you very very much).
In my version
use Win32::GUI(); use Win32::API; Win32::API->Import('kernel32','BOOL SetConsoleIcon(HWND icon)'); SetConsoleIcon( Win32::GUI::Icon->new('box.ico')->{-handle} );
For some reason it only works for some icons.
It seems that Win32::GUI::Icon->new('box.ico') returns undef for some icons, or to be exact, it does the same as in the case I refer to a non-existing icon.
Some icon-format limitation ?

Replies are listed 'Best First'.
Re^3: Can't change icon with win32 module
by bulk88 (Priest) on Sep 22, 2012 at 18:23 UTC
    Tried checking Win32::GetLastError() if creating an Win32::GUI::Icon failed?
      I used Win32::FormatMessage(Win32::GetLastError()) but it returns The operation completed successfully for both icons (those the do and doe that don't give undef).
      It even says the same thing if I use a pl file instead of ico,
      Seems to me to be pretty equivalent to the -e operator.

        I used ...

        Where did you use it? Where did you add it?

        Show your code