Главная страница | назад





Article #16610: displaying an application associated icons

 Question and Answer Database

FAQ1610D.txt   displaying an application associated icons
Category   :Windows API
Platform    :All
Product    :All 32 bit  

Question:
How do I display the icon that is associated with a given file
type?

Answer:
Use the ShellApi function ExtractAssociatedIcon() to retrieve the
icon that is associated with the file.

Example:

uses ShellApi;

procedure TForm1.Button1Click(Sender: TObject);
var
  Icon : hIcon;
  IconIndex : word;

begin
  IconIndex := 1;
  Icon := ExtractAssociatedIcon(HInstance,
                               Application.ExeName,
                               IconIndex);
 DrawIcon(Canvas.Handle, 10, 10, Icon);
end;

7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99