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; ...
随机推荐
- mysql high availability 概述
一.什么是高可用性 1.可用性是指服务不间断运转的时间,通常用百分比来表示,例如 99.999%表示每年最多允许5分钟的宕机时间 2.可用性的效果和开销比例呈线性增长 3.可用性的意义往往也不尽相同, ...
- Oracle 数据库和监听器开机自启动两种实现方法
数据库和监听器开机自启动 编辑oratab文件: 修改:orcl:/u01/app/oracle/product/11.2.0/db_1:N orcl:/u01/app/or ...
- 几种list排序方法
package com.lgx.jdk8.part02; import java.util.*; import java.util.stream.Collectors; /** * Comparato ...
- High-Speed Tracking with Kernelized Correlation Filters
2015年的一篇论文,可参考:http://blog.csdn.net/carrierlxksuper/article/details/46461245. 另参考:http:// ...
- 一步一步学习IdentityServer3 (4)
其实上述例子 很多都很找到 但是在实际生态环境中给例子有很多不一样的地方 比如自定已登录界面怎么做? 怎么访问自己的用户数据库实现登录? 怎么在接口中使用,在接口中又怎么实现与Idr3结合授权? 等等 ...
- hadoop2.5搭建过程
1 搭建环境所使用的资源 VMware Workstation 9 ubuntu-14.04.2-desktop-amd64.iso jdk-7u80-linux-x64.tar.gz hadoop- ...
- K-Means和K Nearest Neighbor
来自酷壳: http://coolshell.cn/articles/7779.html http://coolshell.cn/articles/8052.html
- 【PAT】1091 Acute Stroke(30 分)
1091 Acute Stroke(30 分) One important factor to identify acute stroke (急性脑卒中) is the volume of the s ...
- Argument 1 passed to Illuminate\Auth\SessionGuard::login() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\User given,
使用laravel内置的注册认证系统,注册账号,提示如下错误.Google之后,发现github的一个答案,解决了.分享一下 Argument 1 passed to Illuminate\Auth\ ...
- 003 jquery层次选择器
1.介绍 2.程序 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> < ...