//---------------------------------------------------------------------------
//******** ********
//******** Dieses Beispiel stammt von www.ecodes.de ********
//******** ********
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
//Windows Pfad ermitteln
char CWi[MAX_PATH];
GetWindowsDirectory(CWi, sizeof(CWi));
//Notepad Pfad
AnsiString windir=AnsiString(CWi)+"\\Notepad.exe" ;
//Icon Extrahieren
TIcon *NIC = new TIcon;
NIC->Handle = ExtractIcon((HINSTANCE)HInstance ,windir.c_str() , 0) ;
//Icon darstellen
Image1->Picture->Icon = NIC;
//Icon im App Pfad speichern
AnsiString ExePfad= ExtractFilePath(Application->ExeName);
NIC->SaveToFile(ExePfad+"No.ico");
delete NIC;
}
//---------------------------------------------------------------------------