其实就是根据扩展名取得相关图标.
下面慢函数,你再加一个IMAGELIST配合就可以啦.
function GetIconFromExt(ext:string;var filename:string;var index:integer):boolean;
var
reg:tregistry;
src:string;
begin
reg:=tregistry.create;
reg.RootKey:=hkey_classes_root;
result:=reg.OpenKey('.'+ext,false);
if result then
begin
src:=reg.ReadString('');
reg.CloseKey;
if reg.OpenKey(src+'/defaulticon',false) then
begin
src:=reg.ReadString('');
if pos('%1',src)<>0 then exit;
filename:=copy(src,0,pos(',',src)-1);
index:=strtoint((trim(copy(src,pos(',',src)+1,length(src)-pos(',',src)))));
end;
end;
reg.Free;
end;