再来个问题??

holin 2001-12-21 11:08:04
如何用Delphi编程读取,并显示某个exe或dll或icl文件中的图标呢?
...全文
50 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
holin 2001-12-22
  • 打赏
  • 举报
回复
太感谢了。不过给你加分呢,还是给游少爷加呀?呵呵,给你了吧!!
王集鹄 2001-12-22
  • 打赏
  • 举报
回复
//from
http://www.csdn.net/expert/Topic/409/409823.shtm
回复人: taxi(游少爷) (2001-12-8 10:20:29) 得20分
procedure TfrmMain.ExtractFileIcon(Filename:string);
var
count,index,i:integer;
j:word;
ext:string;
begin
try
if inifile.ReadInteger('ExtractStyle','Option',0)=0 then
lvIcons.Items.BeginUpdate;
ext:=LowerCase(ExtractFileExt(Filename));
if (ext='.exe') or (ext='.dll') or (ext='.icl') then
begin
index:=-1;
count:=ExtractIcon(Hinstance,Pchar(Filename),index);
ProgressBar1.Max:=count;
for i:=0 to count-1 do
begin
ProgressBar1.Position:=i+1;
inc(FIconCount);
SetLength(FIcons,FIconCount);
FIcons[FIconCount-1]:=TIcon.Create;
FIcons[FIconCount-1].Handle:=ExtractIcon(Hinstance,Pchar(Filename),i);
Icons.AddIcon(FIcons[FIconCount-1]);
Image1.Picture.Icon:=FIcons[FIconCount-1];
Application.ProcessMessages;
with lvIcons do
begin
Items.Add;
Items[Items.Count-1].Caption:=ExtractFileName(FileName)+'['+
IntToStr(i+1)+']';
Items[Items.Count-1].ImageIndex:=Items.Count-1;
end;
end;
ProgressBar1.Position:=0;
end
else
begin
j:=0;
inc(FIconCount);
SetLength(FIcons,FIconCount);
FIcons[FIconCount-1]:=TIcon.Create;
FIcons[FIconCount-1].Handle:=ExtractAssociatedIcon(Hinstance,Pchar(Filename),j);
Icons.AddIcon(Ficons[FIconCount-1]);
Image1.Picture.Icon:=FIcons[FIconCount-1];
Application.ProcessMessages;
with lvIcons do
begin
Items.Add;
Items[Items.Count-1].Caption:=ExtractFileName(Filename);
Items[Items.Count-1].ImageIndex:=Items.Count-1;
end;
end;
if inifile.ReadInteger('ExtractStyle','Option',0)=0 then
lvIcons.Items.EndUpdate;
index:=0;
Image1.Picture.Icon.Handle:=ExtractIcon(Hinstance,Pchar(Application.Exename),index);
except
ShowMessage('我kao,发生错误了:(');
end;
end;
Greenberet 2001-12-22
  • 打赏
  • 举报
回复
取ICL/DLL/EXE 等文件中的图标,同样可以用以下API
ExtractIcon --- 读取
DrawIcon ---> 显示
王集鹄 2001-12-21
  • 打赏
  • 举报
回复
icl?
ico?
iriscat 2001-12-21
  • 打赏
  • 举报
回复
有 api 的

好像叫 geticon...

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧