Registriert seit: 4. Jul 2010
Ort: Berlin
62 Beiträge
Delphi XE2 Professional
|
AW: Problem mit SHGetFileInfo und SHGFI_ICONLOCATION
3. Jan 2013, 17:24
Ich hab hier was. Ich brauch das Icon der Datei. Vielleicht hilfts.
Delphi-Quellcode:
function GetGenericIconIndex( AExtension: string ): integer;
{ Get icon index for an extension type }
var
AInfo: TSHFileInfo;
begin
if SHGetFileInfo( PChar( AExtension ), FILE_ATTRIBUTE_NORMAL, AInfo, SizeOf( AInfo ),
SHGFI_SYSICONINDEX or SHGFI_LARGEICON or SHGFI_USEFILEATTRIBUTES ) <> 0 then
Result := AInfo.iIcon
else
Result := -1;
end;
procedure BuildImageList;
var FileInfo: TSHFileInfo;
dw:DWORD;
begin
Inherited Create(AOwner);
fImageList:= TImageList.Create(self);
dw:=SHGetFileInfo('', 0, FileInfo, SizeOf(TSHFileInfo),
SHGFI_LARGEICON or SHGFI_SYSICONINDEX );
if dw>0 then begin
fImageList.Width:= 32;
fImageList.Height:=32;
fImageList.ShareImages:= True;
fImageList.Handle:= dw;
List.LargeImages:= fImageList;// is a TListView !
end;
end;
|
|
Zitat
|