4

How to load a TCustomImageList with all system icons used by Windows in dialog boxes (Standard icons like warning, error, information, confirmation..)?

enter image description here

I would like to find a solution which works on Windows XP and later.

Fabrizio
  • 7,603
  • 6
  • 44
  • 104
  • NB: This is tricky stuff, depending on what you want to do with the image list. See e.g. http://stackoverflow.com/questions/4285890/how-to-load-a-small-system-icon/4286601, http://stackoverflow.com/questions/6613513/compliant-loading-of-small-oem-icon-with-loadimage – Uli Gerhardt Apr 21 '16 at 11:20
  • See also http://www.catch22.net/tuts/system-image-list – Free Consulting Apr 21 '16 at 23:12

1 Answers1

6

See LoadImage and LoadIcon.

Quick example:

procedure TForm1.Button2Click(Sender: TObject);
var
  t_Icon: TIcon;

begin
  t_Icon := TIcon.Create();
  t_Icon.Handle := LoadImage( 0, MAKEINTRESOURCE(32513), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE or LR_SHARED );

  if ( t_Icon.Handle <> 0 ) then
    ImageList1.AddIcon( t_Icon );

// .............

  t_Icon.Free();
end;
kobik
  • 21,001
  • 4
  • 61
  • 121
Old Skull
  • 165
  • 7