清除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. svn 回退/更新/取消至某个版本命令详解【转】

    转自:http://www.cnblogs.com/mfryf/p/4654110.html 1. 取消Add/Delete 取消文件 svn revert 文件名 取消目录 svn revert - ...

  2. php正则字符串提取汉字

    /*$str 为输入.输出字符串变量*/ preg_match_all('/[\x{4e00}-\x{9fff}]+/u', $str, $matches); $str = join('', $mat ...

  3. xunsearch 迅搜初探

    2014年1月2日 19:34:12 [root@localhost bin]# ./php /usr/local/lamp/xunsearch/sdk/php/util/Quest.php demo ...

  4. Nuxt学习笔记

    参考地址:https://zh.nuxtjs.org/guide/installation  官网 http://jspang.com/2018/02/26/nuxt/ 1.目录结构 2.Nuxt常用 ...

  5. JavaScript:document.execCommand()的用法

    document.execCommand()的用法小记 一.语法 execCommand方法是执行一个对当前文档,当前选择或者给出范围的命令.处理Html数据时常用. 如下格式:document.ex ...

  6. ICCV2013 录用论文(目标跟踪相关部分)(转)

    单目标(表观模型): 1. Seunghoon Hong, BohyungHan. Orderless Trackingthrough Model-Averaged Density Estimatio ...

  7. 神奇的Content-Type--在JSON中玩转XXE攻击

    转自:360安全播报http://bobao.360.cn/learning/detail/360.html 大家都知道,许多WEB和移动应用都依赖于Client-Server的WEB通信交互服务.而 ...

  8. Java List 转 String

    JAVA中List转换String,String转换List,Map转换String,String转换Map之间的转换工具类(调优)https://www.cnblogs.com/cn-wxw/p/6 ...

  9. Scala 学习笔记(2)之类和对象

    Scala 的类大抵和 Java 是类似的,简单的例子如下: class MyClass { var myField : Int = 0; def this(value : Int) = { this ...

  10. [转] 在安卓设备上使用 Chrome 远程调试功能

    你的网页内容在移动设备上的体验可能和电脑上完全不同.Chrome DevTools 提供了远程调试功能,这让你可以在安卓设备上实时调试开发的内容. 安卓远程调试支持: 在浏览器选项卡中调试网站. 在原 ...