清除Windows图标缓存的代码:

procedure RebuildIconCache;

....
const
sr_WindowMetrics='Control Panel\Desktop\WindowMetrics\';
sr_ShellIconSize='Shell Icon Size'; function WindowsDir:string;
var
buffer: array [..] of char;
begin
GetWindowsDirectory(@Buffer,SizeOf(buffer));
Result:=Buffer;
end; Function UpdateAllWindowsCallback(WHandle : HWnd;
Var Parm : Pointer) :
Boolean; stdcall;
begin
SendMessage(WHandle,WM_SETTINGCHANGE,,);
Result:=True;
end; Procedure UpdateAllWindows;
Begin
EnumWindows(@UpdateAllWindowsCallback,
WM_SETTINGCHANGE);
End; function GetIconCacheFile:string;
begin
Result:=getwindowspath+'ShellIconCache';
end; procedure DeleteIconCache;
var
sfile:string;
begin
sfile:=GetIconCacheFile;
if fileexists(sfile) then begin
if deletefile(sfile)=false
then showmessage('Can not erase file: '+sfile);
end;
QueryRestartWindows;
end; function RefreshActiveDesktop:boolean;
const
CLSID_ActiveDesktop: TGUID
= '{75048700-EF1F-11D0-9888-006097DEACF9}';
var
ActiveDesktop: IActiveDesktop;
begin
try
ActiveDesktop := CreateComObject(CLSID_ActiveDesktop)
as IActiveDesktop;
ActiveDesktop.ApplyChanges(AD_APPLY_ALL or AD_APPLY_FORCE);
Result:=true;
except
Result:=false;
end;
end; procedure RefreshDesktop;
var
wnd:THandle;
fl:boolean;
begin
fl:=RefreshActiveDesktop;
if fl=false then begin
wnd:=FindWindow('Progman', 'Program Manager');
if wnd<> then SendMessage(wnd,WM_COMMAND,$A065,)
else UpdateAllWindows;
end;
end; procedure RebuildIconCache;
var
news,olds:string;
sz:integer;
begin
Startwait;
try
deletefile(GetIconCacheFile);
olds:=regreadstring(HKEY_CURRENT_USER,
sr_WindowMetrics+sr_ShellIconSize);
sz:=strtointdef(olds,);
inc(sz);
news:=inttostr(sz);
regwritestring(HKEY_CURRENT_USER,
sr_WindowMetrics+sr_ShellIconSize,news);
UpdateAllWindows;
if olds='' then olds:='';
regwritestring(HKEY_CURRENT_USER,
sr_WindowMetrics+sr_ShellIconSize,olds);
UpdateAllWindows;
RefreshDeskTop;
finally
StopWait;
end;
end;

Icon cache rebuilding with Delphi(Delphi 清除Windows 图标缓存源代码)的更多相关文章

  1. 清理Windows图标缓存 | 懒人屋

    原文:清理Windows图标缓存 | 懒人屋 文章背景 这是一个抄袭的文章,原文在参考资料中 运行环境 操作系统:Windows 10 x64(1903) 清理脚本 @echo off rem 关闭W ...

  2. 程序修改图标后显示未更新——强制刷新windows图标缓存

    http://blog.csdn.net/vvlowkey/article/details/51133486 20160412 问题:修改兴迪局放测量软件图标后,release文件夹中生成文件的小图标 ...

  3. 重建 windows 图标缓存

    执行命令: ie4uinit –show 好像可以吧?

  4. 浅议Delphi中的Windows API调用(举的两个例子分别是String和API,都不错,挺具有代表性)

    浅议Delphi中的Windows API调用http://tech.163.com/school • 2005-08-15 10:57:41 • 来源: 天极网为了能在Windows下快速开发应用程 ...

  5. Delphi 弹出Windows风格的选择文件夹对话框, 还可以新建文件夹

    Delphi 弹出Windows风格的选择文件夹对话框, 还可以新建文件夹     unit Unit2; interface uses  Windows, Messages, SysUtils, V ...

  6. Delphi里的Windows消息(可查MSDN指定位置)

    各种控件的通知消码和控制消息可由MSDN-> Platform SDK-> User Interface Services->Windows User Interface->C ...

  7. Delphi 7使用自定义图标关联文件类型

    Delphi 7使用自定义图标关联文件类型 5.2 Delphi编程(40)  版权声明:本文为博主原创文章,未经博主允许不得转载. 在开发过程中,我们经常需要属于自己的文件类型,自定义的后缀名不仅可 ...

  8. Delphi产生任务栏图标【TNotifyIconData】

    一.新建一个应用程序:File->New Applicaton 在Interface部分要放在Uses Message之后,定义一个消息常量:const WM_NID=WM_USER+1000; ...

  9. Delphi产生任务栏图标【TNotifyIconData】(转载)

    一.新建一个应用程序:File->New Applicaton 在Interface部分要放在Uses Message之后,定义一个消息常量:const WM_NID=WM_USER+1000; ...

随机推荐

  1. Jquery ajax json 不执行success的原因 坑爹

    最近在看jQuery的API文档,在使用到jQuery的ajax时,如果指定了dataType为json,老是不执行success回调,而是执行了error回调函数,极度郁闷.后面改为1.2.6版本可 ...

  2. 『实践』VirtualBox 5.1.18+Centos 6.8+hadoop 2.7.3搭建hadoop完全分布式集群及基于HDFS的网盘实现

    『实践』VirtualBox 5.1.18+Centos 6.8+hadoop 2.7.3搭建hadoop完全分布式集群及基于HDFS的网盘实现 1.基本设定和软件版本 主机名 ip 对应角色 mas ...

  3. Go语言Windows 10开发环境搭建:Eclipse+GoClipse

    Intel Core i5-8250U,Windows 10家庭中文版,go version go1.11 windows/amd64, Eclipse IDE for C/C++ Developer ...

  4. VS Code 折腾记 - (5) Angular 2+ && Typescript 2 + 必备插件推荐

    前言 说起来我会用VSCode,有很大一方面是因为工作需求[以前主力工具是Atom],刚好公司的前端技术栈是NG2+TS2;对于喜欢折腾的我,裸奔的VSCODE是不可以接受的.so-. eg: vsc ...

  5. js 获取json对象的Key、value(js遍历json对象的key和value)

    <script type="text/javascript"> getJson('age'); function getJson(key){ "," ...

  6. JavaScript——双向链表实现

    本文版权归博客园和作者吴双本人共同所有,转载和爬虫请注明原文链接 http://www.cnblogs.com/tdws/ 下午分享了JavaScript实现单向链表,晚上就来补充下双向链表吧.对链表 ...

  7. 富文本编辑器&FileReader

    最近在做一个web版的管理Tool,其中包括一个编辑框,要求能够编辑文字,插入图片,最后导出做成一个Html.对于资深人士看来,这很容易啊,不就是一个富文本编辑框吗?这其实就是一个概念的问题,对有经验 ...

  8. 【LOJ】#2082. 「JSOI2016」炸弹攻击 2

    题解 想到n3发现思路有点卡住了 对于每个发射塔把激光塔和敌人按照极角排序,对于一个激光塔,和它转角不超过pi的激光塔中间夹的敌人总和就是答案 记录前缀和,用two-Points扫一下就行 代码 #i ...

  9. Codeforces 280C Game on Tree 期望

    Game on Tree 这种题好像在wannfly训练营讲过, 我怎么又不会写啦, 我好菜啊啊啊. 我们按每个点算贡献, 一个点有贡献就说明它是被选中的点, 那么它被选中的概率就为1 / depth ...

  10. java 生成随机数字

    for(int i=0;i<size1;i++){ int n = (int)(java.lang.Math.random()*99); LinkNode newLink = new LinkN ...