[Lazarus] Win32 HICON

Paul Ishenin webpirat at mail.ru
Fri Dec 19 00:49:43 CET 2008


JoshyFun wrote:
> I only have a HICON reported by Windows, I try to create a TIcon
> using:
>
> Ic:=TIcon.Create;
> Ic.Handle:=HICON;
>
> But I'm quite sure this is buggy and also I'm unable to add a TIcon to
> the image list in any way.
>   
No, it is not buggy. TIcon must work this way too. About TImageList - it 
just does not supports AddIcon method at moment.
Try to create a Bitmap and assign your icon to it first then add that 
bitmap into imagelist:

var
  B: TBitmap;
begin
  B := TBitmap.Create;
  B.Assign(Ic);
  ImageList.Add(Ic, nil);
end;

Best regards,
Paul Ishenin.



More information about the Lazarus mailing list