Mirror

How to retrieve the icons of a MessageBox (Views: 36)


Problem/Question/Abstract:

How can I retrieve the MessageBox images (MB_ICONINFORMATION, MB_ICONERROR etc.) for use in a TListView?

Answer:

You can use the LoadIcon API to get the images:

procedure TForm1.Button1Click(Sender: TObject);
const
  Size = 6;
  IconArray: array[0..Size - 1] of PChar = (IDI_APPLICATION, IDI_ASTERISK,
    IDI_EXCLAMATION,
    IDI_HAND, IDI_QUESTION, IDI_WINLOGO);
begin
  Image1.Picture.Icon.Handle := LoadIcon(0, IconArray[5]);
end;

<< Back to main page