System Icons
-
hallo
ich möchte die System Icons, oder die Icons einer Datei in ein TImageList laden.
Da die forum suche nichts sinnvolles Ausspuckt und die anderen dinge ich irgendwie nicht hinbekomme.HICON TfmMain::GetFileIconHandle(AnsiString strFileName, bool bSmallIcon) { SHFILEINFO sfi; if (bSmallIcon) { SHGetFileInfo( strFileName.c_str(), FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(SHFILEINFO), SHGFI_ICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES); } else { SHGetFileInfo( strFileName.c_str(), FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(SHFILEINFO), SHGFI_ICON | SHGFI_LARGEICON | SHGFI_USEFILEATTRIBUTES); } return sfi.hIconDamit hab ichs versucht, aber ich find nicht über "HICON" und komm da net weiter!
vll könnt ihr mir helfen
Gruß KY
-
Hi,
kannst du nicht ExtractIcon bzw. ExtractIconEx nehmen?
//--------------------------------------------------------------------------- void TForm1::FillImageList(const String & FileName) { int AnzahlIcons = int(ExtractIcon(Form1->Handle, FileName.c_str(), -1) ); if (AnzahlIcons != NULL) { TIcon *MyIcon = new TIcon(); for (int i=0;i<AnzahlIcons;i++) { MyIcon->Handle = ExtractIcon(Form1->Handle,FileName.c_str(),i); ImageList1->AddIcon(MyIcon); } } } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { FillImageList("C:\\WINDOWS\\system32\\SHELL32.dll"); for(int i=0;i<ImageList1->Count;i++) { TIcon *MyIcon = new TIcon(); try { ImageList1->GetIcon(i,MyIcon); Image1->Canvas->Draw(1,(ImageList1->Height*i)+2,MyIcon); } catch(Exception & ex) { ShowMessage(ex.Message); } } } //---------------------------------------------------------------------------MfG Barracuda
-
cool funktioniert super!!
weißt du auch wie ich herausfinden kann, welches icon ein ordner oder eine datei hat, die ich mit findfirst, findnext,... gefunden hab?
Gruß und Danke KY