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





Article #17532: How do I display the icon that is associated with...?

 Question and Answer Database
FAQ2532C.txt How do I display the icon that is associated with...?
Category :Windows API
Platform :All
Product :C++Builder 3.x
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:
#include 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
HICON Icon;
unsigned short* IconIndex;
Icon = ExtractAssociatedIcon(HInstance,
"C:\\SomePath\\SomeFile.ext",
IconIndex);
DrawIcon(Form1->Canvas->Handle, 10, 10, Icon);
}
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99