用TTreeView编了似资源管理器的树形目录,顶层“我的电脑”图标怎样取到?100分! 盘符与文件夹与文件名的图标用API都解决了,树根是“我的电脑”这个系统小图标怎样取到呢? + 我的电脑 + A: + C: +Windows + D: + E可执行一下资源管理器,看看“我的电脑”的图标形状,这是系统图标。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我想问一下你用什么API取的文件的图标啊谢谢 发到我的信箱里 没找到API方法前,我建议你取个“我的电脑”的真彩图标,explorer.exe内就有,并把你这个图标当作你程序的图标,TreeView的顶层“我的电脑”就用你程序(Application->ExeName)的图标当作图标! procedure TFolderImage.DoLoadImageThumbnail(AFileName:String;var ABitmap:TBitmap);var Icon:TIcon; shinfo:SHFileInfo; OriSize,NewSize:TSize; Rect:TRect; FolderTmp:String;begin FolderTmp:=AFileName; if (ExtractFileName(FolderTmp)='..') then begin FolderTmp:=Copy(FolderTmp,1,LastDelimiter('\',FolderTmp)-1); FolderTmp:=Copy(FolderTmp,1,LastDelimiter('\',FolderTmp)); end; Icon:=TIcon.Create(); try if SHGetFileInfo(pchar(FolderTmp),0,shinfo,sizeof(shinfo),SHGFI_ICON)=0 then begin raise Exception.Create('TFolderImage: Error when load folder''s icon'); end; Icon.Handle:=shinfo.hIcon; Icon.Transparent:=false; OriSize.cx:=Icon.Width; OriSize.cy:=Icon.Height; NewSize:=GetThumbnailSize(OriSize); ABitmap.Width:=NewSize.cx; ABitmap.Height:=NewSize.cy; Rect.Left:=0; Rect.Top:=0; Rect.Right:=NewSize.cx; Rect.Bottom:=NewSize.cy; ABitmap.Canvas.Brush.Color:=clBtnFace; ABitmap.Canvas.FillRect(Rect); ABitmap.Canvas.StretchDraw(Rect,Icon); finally Icon.Free; end;end;这段程序是取某个文件夹的图标用的,桌面的话,它的对应路径其实应该是:C:\Documents and Settings\Administrator\Desktop 嗬嗬,有这么一个DLL,那就是在WINNT\system32\shell32.dll,图标就在里面。我这个是笨笨的办法啊,LoadLibrary它吧。或者去下载一个图表库,网络上很多的哦。 是用ImageList,句柄是系统的,问题是:“我的电脑”图标怎样从这个ImageList1中取到ImageIndex呀 用BCB的方法可以,但不是最佳方法 急聘 有关从datasetA获取datasetB的问题 请问一字段要存储byte数组,应该如何操作? build 具体是做什么的? 谁有fast report ?20分 关于delphi入门教材 高分求教INTRAWE的数据库问题 D2->D7的下载地址... 谁有软件项目计划书啊?第一次做,需要一份做参考!谢了 DELPHI里有控件数组吗? Delphi6报错[Error] RLINK32: Error opening file,何解??!!! 如何在程序开始前加入一个密码框,原理是什么?程序要怎么写?最好能有例子.
谢谢
发到我的信箱里
并把你这个图标当作你程序的图标,TreeView的顶层“我的电脑”就用
你程序(Application->ExeName)的图标当作图标!
var
Icon:TIcon;
shinfo:SHFileInfo;
OriSize,NewSize:TSize;
Rect:TRect;
FolderTmp:String;
begin
FolderTmp:=AFileName;
if (ExtractFileName(FolderTmp)='..') then begin
FolderTmp:=Copy(FolderTmp,1,LastDelimiter('\',FolderTmp)-1);
FolderTmp:=Copy(FolderTmp,1,LastDelimiter('\',FolderTmp));
end;
Icon:=TIcon.Create();
try
if SHGetFileInfo(pchar(FolderTmp),0,shinfo,sizeof(shinfo),SHGFI_ICON)=0 then begin
raise Exception.Create('TFolderImage: Error when load folder''s icon');
end;
Icon.Handle:=shinfo.hIcon;
Icon.Transparent:=false;
OriSize.cx:=Icon.Width;
OriSize.cy:=Icon.Height;
NewSize:=GetThumbnailSize(OriSize);
ABitmap.Width:=NewSize.cx;
ABitmap.Height:=NewSize.cy;
Rect.Left:=0;
Rect.Top:=0;
Rect.Right:=NewSize.cx;
Rect.Bottom:=NewSize.cy;
ABitmap.Canvas.Brush.Color:=clBtnFace;
ABitmap.Canvas.FillRect(Rect);
ABitmap.Canvas.StretchDraw(Rect,Icon);
finally
Icon.Free;
end;
end;这段程序是取某个文件夹的图标用的,桌面的话,它的对应路径其实应该是:
C:\Documents and Settings\Administrator\Desktop
ImageList1中取到ImageIndex呀