function Icon2Bitmap(Icon: HICON): HBITMAP;
var
i: TIcon;
b: TBitmap;
begin
i := nil;
b := nil;
try
i := TIcon.Create;
b := TBitmap.Create;
i.Handle := Icon;
b.Height := i.Height;
b.Width := i.Width;
b.Canvas.Draw(0, 0, i);
result := CopyImage(b.Handle, IMAGE_BITMAP, 0, 0,
LR_COPYRETURNORG);
finally
i.Free;
b.Free;
end;
end;
function Icon2Bitmap(Icon: HICON): HBITMAP;
var
IconInfo: TIconInfo;
begin
if not GetIconInfo(Icon, IconInfo) then
raise EInvalidIcon('Bad handle to icon')
else
Result := IconInfo.hbmColor;
end;
----
If you're interested in the MS party line with regard to Icons in Win32,
have a look at: "http://www.microsoft.com/win32dev/ui/icons.htm"
You may also care to examine Wotsit's file format collection (a
generally valuable resource) at: "http://www.wotsit.org"
----------