如何获得应用程序的图标并添加到imagelist中呢???急 如何获得应用程序的图标呢????添加到imagelist呢??Extracticon么?具体给点代码吧!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 uses ShellAPI;procedure TForm1.Button1Click(Sender: TObject);var icLarge, icSmall: TIcon; hLarge, hSmall: HICON;begin icLarge := TIcon.Create(); icSmall := TIcon.Create(); ExtractIconEx('C:\Program Files\Borland\Delphi7\Bin\Delphi32.exe', 0, hLarge, hSmall, 1); icLarge.Handle := hLarge; icSmall.Handle := hSmall; ImageList1.AddIcon(icLarge); ImageList1.AddIcon(icSmall);end; 有两个函数可以用:var FileInfo:_SHFILEINFO; sName:string; FileIcon:TIcon; Num:Integer;1.SHGetFileInfo.begin try FileIcon:=TIcon.Create; SHGetFileInfo(pchar(sName),0,FileInfo,sizeof(FileInfo),SHGFI_ICON); FileIcon.handle:=FileInfo.HIcon; ImageList1.addicon(FileIcon);//该函数的返回值为Icon在ImageList1中的Index. finally FileIcon.Free; end;end;2.ExtractIconbegin try FileIcon:=TIcon.Create; Num:=ExtractIcon(hInstance,pchar(sName),LongWord(-1));//取得文件中的Icon的数目 if Num>0 then begin FileIcon.HIcon:=ExtractIcon(hInstance,pchar(sName),LongWord(0)); ImageList1.addicon(FileIcon); end; Finally FileIcon.Free; end;end;这两个函数的具体用法你可以查阅Delphi的帮助文档,也可以查阅介绍Api的一些资料 TIdTcpserver如何保持多个客户端数据同步? 向自己提问,哈哈 求教:关于程序中ADOConnection的问题! 急切求助:在先等待! 程序老出现死机,谁能指点一二。 请问socket,UDP,TCP之间是什么样的关系? 想买以下几本书大家提个意见 急!急!FASTREPORT报表制作的问题! MDI程序出错呀! dephi中的报表打印为什么每次只列出一条记录??? 我想动态加载类的引用,怎么办?有象java 里面的类似reflection 的技术吗? 菜鸟说:mainmenu控件好好玩
ShellAPI;procedure TForm1.Button1Click(Sender: TObject);
var
icLarge, icSmall: TIcon;
hLarge, hSmall: HICON;
begin
icLarge := TIcon.Create();
icSmall := TIcon.Create();
ExtractIconEx('C:\Program Files\Borland\Delphi7\Bin\Delphi32.exe',
0,
hLarge,
hSmall,
1);
icLarge.Handle := hLarge;
icSmall.Handle := hSmall;
ImageList1.AddIcon(icLarge);
ImageList1.AddIcon(icSmall);end;
var
FileInfo:_SHFILEINFO;
sName:string;
FileIcon:TIcon;
Num:Integer;
1.SHGetFileInfo.
begin
try
FileIcon:=TIcon.Create;
SHGetFileInfo(pchar(sName),0,FileInfo,sizeof(FileInfo),SHGFI_ICON);
FileIcon.handle:=FileInfo.HIcon;
ImageList1.addicon(FileIcon);//该函数的返回值为Icon在ImageList1中的Index.
finally
FileIcon.Free;
end;
end;
2.ExtractIcon
begin
try
FileIcon:=TIcon.Create;
Num:=ExtractIcon(hInstance,pchar(sName),LongWord(-1));//取得文件中的Icon的数目
if Num>0 then
begin
FileIcon.HIcon:=ExtractIcon(hInstance,pchar(sName),LongWord(0));
ImageList1.addicon(FileIcon);
end;
Finally
FileIcon.Free;
end;
end;
这两个函数的具体用法你可以查阅Delphi的帮助文档,也可以查阅介绍Api的一些资料