收藏好几种方法,都试试
1:最有效的: 结束explorer.exeDo
ProcessClose("explorer.exe")
Until Not ProcessExists("explorer.exe")
;;2、调用SendMessageTimeout。效果不理想。DllCall("user32.dll","int","SendMessageTimeout","hwnd",65535,"int",26,"int",0,"int",0,"int",0,"int",1000,"str","dwResult")
;;3、调用组策略刷新设置工具,测试无效
Run("gpupdate /force",@SystemDir)
;;4、又一刷新注册表的API,非常强捍。效果不错DllCall("shell32.dll", "none", "SHChangeNotify", "long", 0x8000000, "int", 0, "ptr", 0, "ptr", 0)
;;5、刷新桌面Run ("RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters")
;6.另一种APIGlobal Const $RP_FORCE = 1
Global Const $True = 1
Global Const $False = 0
$bMachine = $True
Dim $Return
$Return = DllCAll("Userenv.dll","int","RefreshPolicyEx","int",$bMachine,"int",$RP_FORCE)
If IsArray($Return) Then
If $Return[0] <> 0 Then
MsgBox(0,"","操作成功.返回值:" & $Return[0])
Else
MsgBox(0,"","操作失败.返回值:" & $Return[0])
EndIf
EndIf
Exit
|