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





Article #17173: How do I Extract an icon from exe or dll

 Question and Answer Database
FAQ2173C.txt How do I Extract an icon from exe or dll
Category :Windows API
Platform :All
Product :C++Builder 1.x
Question:
How do I Extract an icon from another executable or dll in code?
Answer:
Use the Windows API function ExtractIcon(), passing it the instance
handle of your application, the path name of the application you wish
to extract the icon from, and the number of the icon you wish to
extract.Use the Windows API function ExtractIcon(), passing it the instance
handle of your application, the path name of the application you wish
to extract the icon from, and the number of the icon you wish to
extract.
Example:
// in header file
TIcon *theIcon;
// implementation
void __fastcall TForm1::Button1Click(TObject *Sender)
{
theIcon = new TIcon;
theIcon->Handle = ExtractIcon(HInstance,
"C:\\somepath\\someprog.exe",
0);
// Do something with the Icon
theIcon->Free();
}
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99