这个页面有一个重建缓存的VB程序(查看frmRebuiltIconCache.frm的实际代码)
它所做的是检查 的值HKCU\Control Panel\Desktop\WindowMetrics\Shell Icon Size
,从中减去 1,通过 强制超时SendMessageTimeout
,然后重置值,并重复超时
由于您无法从 vbs(没有外部程序)调用 DLL,这可能无法满足您的需求。我已将程序缩减为:
'SendMessageTimeout values
Const HWND_BROADCAST = &HFFFF
Const WM_SETTINGCHANGE = &H1A
Const SPI_SETNONCLIENTMETRICS = &H2A
Const SMTO_ABORTIFHUNG = &H2
'Private Declare Function SendMessageTimeout Lib "user32" Alias "SendMessageTimeoutA" _
' (ByVal hwnd As Long, ByVal msg As Long, _
' ByVal wParam As Long, ByVal lParam As Long, _
' ByVal fuFlags As Long, ByVal uTimeout As Long, _
' lpdwResult As Long) As Long
Dim icon_size
Dim new_icon_size
Dim result
Dim SysVarReg
Set SysVarReg = WScript.CreateObject("WScript.Shell")
' Get the current icon size.
icon_size = SysVarReg.RegRead ("HKCU\Control Panel\Desktop\WindowMetrics\Shell Icon Size")
' Increase the value by 1.
new_icon_size = CInt(icon_size) + 1
SysVarReg.RegWrite "HKCU\Control Panel\Desktop\WindowMetrics\Shell Icon Size", new_icon_size
' Send HWND_BROADCAST to refresh the icons.
SendMessageTimeout HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETNONCLIENTMETRICS, 0, SMTO_ABORTIFHUNG, 10000, result
' Restore the original value.
SysVarReg.RegWrite "HKCU\Control Panel\Desktop\WindowMetrics\Shell Icon Size", icon_size
' Send HWND_BROADCAST to refresh the icons again.
SendMessageTimeout HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETNONCLIENTMETRICS, 0, SMTO_ABORTIFHUNG, 10000, result
但是如果没有东西来包装 DLL 调用,您将无法通过 vbs 执行此操作