[Lazarus] Win32 HICON

JoshyFun joshyfun at gmail.com
Fri Dec 19 11:39:37 CET 2008


Hello Paul,

Friday, December 19, 2008, 12:49:43 AM, you wrote:

PI> No, it is not buggy. TIcon must work this way too. About TImageList - it
PI> just does not supports AddIcon method at moment.
PI> Try to create a Bitmap and assign your icon to it first then add that
PI> bitmap into imagelist:

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

Do not work, but the problem seems to not be related to the bitmap
creation, instead in the TIcon creation as:

var
  IC: TIcon;
begin
  IC:=TIcon.Create();
  IC.Handle:=MyHICON;
  Writeln(format('%d,%d',[IC.Width,IC.Height]);
  IC.SetSize(16,16);
  Writeln(format('%d,%d',[IC.Width,IC.Height]);
end;

returns two nice "0,0" :-? So I'm not completly sure that this is the
process I must follow to generate the TIcon object. I'll try to, using
win32 api, draw the icon somewhere to verify that MyHICON is the
expected HICON and not other kind of handle.

-- 
Best regards,
 JoshyFun




More information about the Lazarus mailing list