最快的方式来获取shell图标 [英] Fastest way to get shell icon
本文介绍了最快的方式来获取shell图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用此代码获取shell图标(Windows资源管理器中显示的)。
有没有人有更快的方式获得这些图标的经验? SHGetFileInfo
似乎相当缓慢。
I'm using this code for getting the shell icon (the one displayed in Windows Explorer).
Does anyone has an experience with a faster way to get these icons ? The SHGetFileInfo
seems to be quite slow.
procedure TForm2.Button1Click(Sender: TObject);
var
FileInfo: TSHFileInfo;
begin
FillChar(FileInfo, SizeOf(FileInfo), 0);
if SHGetFileInfo(PChar('c:\windows\'), 0, FileInfo, SizeOf(FileInfo),
SHGFI_ICON or SHGFI_SMALLICON or SHGFI_SYSICONINDEX) <> 0 then
DrawIconEx(Canvas.Handle, 10, 10, FileInfo.hIcon, 0, 16, 16, 0, DI_IMAGE or
DI_MASK);
end;
谢谢!
推荐答案
尝试使用 SHGFI_USEFILEATTRIBUTES 标志。请参阅文章 调整SHGetFileInfo以获得最佳性能
和 SHGFI_USEFILEATTRIBUTES是什么意思? / code>
获取更多信息。
Try using the SHGFI_USEFILEATTRIBUTES flag as well. See the articles Tuning SHGetFileInfo for Optimum Performance
and What does SHGFI_USEFILEATTRIBUTES mean?
for more information.
这篇关于最快的方式来获取shell图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文