Icon cache rebuilding with Delphi(Delphi 清除Windows 图标缓存源代码)
清除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 图标缓存源代码)的更多相关文章
- 清理Windows图标缓存 | 懒人屋
原文:清理Windows图标缓存 | 懒人屋 文章背景 这是一个抄袭的文章,原文在参考资料中 运行环境 操作系统:Windows 10 x64(1903) 清理脚本 @echo off rem 关闭W ...
- 程序修改图标后显示未更新——强制刷新windows图标缓存
http://blog.csdn.net/vvlowkey/article/details/51133486 20160412 问题:修改兴迪局放测量软件图标后,release文件夹中生成文件的小图标 ...
- 重建 windows 图标缓存
执行命令: ie4uinit –show 好像可以吧?
- 浅议Delphi中的Windows API调用(举的两个例子分别是String和API,都不错,挺具有代表性)
浅议Delphi中的Windows API调用http://tech.163.com/school • 2005-08-15 10:57:41 • 来源: 天极网为了能在Windows下快速开发应用程 ...
- Delphi 弹出Windows风格的选择文件夹对话框, 还可以新建文件夹
Delphi 弹出Windows风格的选择文件夹对话框, 还可以新建文件夹 unit Unit2; interface uses Windows, Messages, SysUtils, V ...
- Delphi里的Windows消息(可查MSDN指定位置)
各种控件的通知消码和控制消息可由MSDN-> Platform SDK-> User Interface Services->Windows User Interface->C ...
- Delphi 7使用自定义图标关联文件类型
Delphi 7使用自定义图标关联文件类型 5.2 Delphi编程(40) 版权声明:本文为博主原创文章,未经博主允许不得转载. 在开发过程中,我们经常需要属于自己的文件类型,自定义的后缀名不仅可 ...
- Delphi产生任务栏图标【TNotifyIconData】
一.新建一个应用程序:File->New Applicaton 在Interface部分要放在Uses Message之后,定义一个消息常量:const WM_NID=WM_USER+1000; ...
- Delphi产生任务栏图标【TNotifyIconData】(转载)
一.新建一个应用程序:File->New Applicaton 在Interface部分要放在Uses Message之后,定义一个消息常量:const WM_NID=WM_USER+1000; ...
随机推荐
- python里面的引用
1 对象及其引用 python中,引用是用命名空间来实现的,命名空间维护了变量和对象之间的引用关系. myInt = 27 yourInt = myInt #change the value of y ...
- How to fix Eclipse Tomcat startup timeout in 45 seconds?
命题:怎么修复 Eclipse 里启动 Tomcat 时, 默认启动超时时间为 45 秒的问题? 在 Eclipse 的 J2EE 项目里启动 Tomcat 来调试 Servlet 之类的,断点以后, ...
- synchronized和lock
Synchronized 同步代码块 使用 monitorenter 和 moniterexit 指令实现, monitorenter指令插入到同步代码块的开始位置, moniterexit 指令插 ...
- [更新]一份包含: 采用RSA JWT(Json Web Token, RSA加密)的OAUTH2.0,HTTP BASIC,本地数据库验证,Windows域验证,单点登录的Spring Security配置文件
没有任何注释,表怪我(¬_¬) 更新: 2016.05.29: 将AuthorizationServer和ResourceServer分开配置 2016.05.29: Token获取采用Http Ba ...
- 【BZOJ】4361: isn
题解 可以想一下保留一个长度为k的不降序列方案数是\(f[k] (n - k)!\) \(f[k]\)是有多少个长度为k的不降序列 我们去掉不合法的,一定是前一次操作的时候有一个长度为\(k + 1\ ...
- 【LOJ】 #6012. 「网络流 24 题」分配问题
题解 又写了一遍KM算法,这题刚好是把最大最小KM拼在一起写的,感觉比较有记录价值 感觉KM始终不熟啊QAQ 算法流程大抵如下,原理就是每次我们通过减少最少的匹配量达成最大匹配,所以获得的一定是最大价 ...
- SQL中的坑
一.where,group by,having --group by 和having 解释:前提必须了解sql语言中一种特殊的函数:聚合函数, 例如SUM, COUNT, MAX, AVG等.这些函数 ...
- 阿里云 rds python sdk不支持python3处理
阿里云文档中心的python版本aliyun-python-sdk-rds不支持python3处理 问题:默认情况下文档中心的python版本只支持python2,不兼容python3版本 需要稍微修 ...
- CSS html标签元素分类
在CSS中,html中的标签元素大体被分为三种不同的类型: 块状元素.内联元素(又叫行内元素)和内联块状元素. 常用的块状元素有: <div>.<p>.<h1>… ...
- 100BASE-TX / 100BASE-T4/100BASE-FX
IEEE标准共有以下几种:10BASE-5:粗缆.最大传输距离500米,使用AUI连接器连接或使用收发器电缆和收发器(MAU)进行连接.10BASE-2:细缆.实际传输距离为185米,使用BNC连接器 ...