Alex Lee wrote:
> Hi all,
>
> Iam trying to extract an icon from a dll file like such:
>
> ######## code
> my $A = 0;
> my $B = 'shimgvw.dll';  ## I want icon 1 in this dll file
>
> my $apiExecute = new Win32::API("Shell32", "ExtractIcon", ['P','P','N'],
'N');
> my $hIcon= $apiExecute->Call($A,$B,1);
>
> ########
>
> The problem is that the above method returns a handle (whatever that
means) to
> the icon.  I need a way to either convert the handle into an actual icon
or just
> display it.

you can already treat the handle as an actual icon. each GUI object that has
an
handle can be passed to Win32::GUI functions as it were a regular Win32::GUI
object. the only difference is that it's not blessed, so you can't call
methods
on it. so you can do for example:

  $Window->ChangeIcon( $hIcon );

the same applies to windows too, so you can do the following:

  my $hWnd = Win32::GUI::GetDesktopWindow();
  print Win32::GUI::Height($hWnd); #### but not $hWnd->Height();

the trick is that Win32 APIs *always* want handles as their parameters, so
Win32::GUI does the following: if the value is a reference (eg. a blessed
perl var), it fetches the {-handle} key from the underlying hash, otherwise
it uses the value as a numeric (eg. the handle itself).


cheers,
Aldo

__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;


Reply via email to