本帖最后由 hanz_200 于 2012-8-5 12:03 编辑
我的文档注册表:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders]
"Personal"="D:\\Prefiles\\Documents"
在更改了路径之后,鼠标右键点击我的文档属性,在目标文件夹内显示的仍然是未改之前的样子。
只有重启之后才能生效。
请教一下P大还有其他高手如何解决。
以下方法已经尝试过了,不好用。
1.Func _BroadcastChange()
Local Const $HWND_BROADCAST = 0xffff
Local Const $WM_SETTINGCHANGE = 0x1a
Local Const $SPI_SETNONCLIENTMETRICS = 0x2a
Local Const $SMTO_ABORTIFHUNG = 0x2
$bcResult = DllCall("user32.dll", "lresult", "SendMessageTimeout", _
"hwnd", $HWND_BROADCAST, _
"uint", $WM_SETTINGCHANGE, _
"wparam", $SPI_SETNONCLIENTMETRICS, _
"lparam", 0, _
"uint", $SMTO_ABORTIFHUNG, _
"uint", 10000, _
"dword*", "success")
If @error Then Return 0
Return $bcResult[0]
EndFunc ;==> _BroadcastChange()
2.Func _Update_Explorer()
Local $bOld = Opt("WinSearchChildren", True)
Local $a = WinList("[CLASS:SHELLDLL_DefView]")
For $i = 0 To UBound($a) - 1
DllCall("user32.dll", "long", "SendMessage", "hwnd", $a[$i][1], "int", 0x111, "int", 28931, "int", 0)
Next
Opt("WinSearchChildren", $bOld)
EndFunc;==>_Update_Explorer
3.结束explorer进程 |