hi
please see attached.
im using the following code to get the file icon according to its extention, put it in an image list and assign the relevant imageindex
function GetFileIcon(const FileName:string; var ImgListTarget:TImageList):Integer;
var FileInfo: SHFileInfoW;
Name :array[0..255] of Char;
Icon1 :TIcon;
p : Word;
begin
Result := -1;
try
if FileExists(FileName) then
begin
Icon1 :=TIcon.Create;
try
Result:=-1;
Icon1.Handle:= ExtractAssociatedIcon(HINSTANCE,StrPCopy(Name,FileName),p);
if Icon1.Handle<>0 then
Result:=ImgListTarget.AddIcon(Icon1);
finally
icon1.free;
end;
end
else
begin
SHGetFileInfo(PWideChar('x' + ExtractFileExt(FileName)), 0, FileInfo, SizeOf(FileInfo), SHGFI_ICON + SHGFI_SMALLICON + SHGFI_USEFILEATTRIBUTES + SHGFI_TYPENAME);
try
Result := ImageList_AddIcon(ImgListTarget.Handle,FileInfo.hIcon);
except
Result := -1;
end;
end;
except
;
end;
end;
any idea why the txt icon is ok while the php icon has a black background?
i changed the imagelist drawingstyle to dsTransparent but it didnt change anything
please advice
thanks