|
本帖最后由 micmouse521 于 2011-8-29 15:39 编辑
无聊
由于某些方面的原因,总是来回切换文件夹选项中隐藏文件的功能,于是想自己写个小程序直接实现这个功能,自己修改注册表。
功能是实现了,不过还是有个问题。
大家看看有没有好的办法
我用au3脚本实现打开文件选项中的隐藏文件和驱动器选项后,每次进程我的电脑,得刷新一下
要不然还是和没改一样
于是想到了是不是注册表没有生效
在网上找了半天,找到两种方法,可是用了没有效果
我的脚本au3#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author: mic
Script Function:
文件夹选项 ==若为查看,则将查看隐藏文件改为不查看隐藏文件
若为不查看,则将不查看隐藏文件改为查看隐藏文件
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#cs
;查看隐藏文件设置,测底隐藏文件
$status = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL", "CheckedValue")
$proxy = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL", "DefaultValue")
MsgBox(48,"查询结果","CheckedValue:"&$status&@CRLF&"DefaultValue:"&$proxy)
$status = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\NOHIDDEN", "CheckedValue")
$proxy = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\NOHIDDEN", "DefaultValue")
MsgBox(48,"查询结果","CheckedValue:"&$status&@CRLF&"DefaultValue:"&$proxy)
;查看文件夹选项中的隐藏文件设置
#ce
$status = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced","Hidden")
If $status = 2 Then
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced","Hidden", "REG_DWORD", 1)
MsgBox(64,@UserName,"文件夹选项当前状态为:"&@CRLF&" 显示隐藏文件和驱动器")
Else
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced","Hidden", "REG_DWORD", 2)
MsgBox(48,@UserName,"文件夹选项当前状态为:"&@CRLF&" 不显示隐藏文件和驱动器")
EndIf
; Run("secedit /refreshpolicy machine_policy /enforce", "", @SW_HIDE)
; Run("secedit /refreshpolicy machine_policy /enforce", "", @SW_HIDE)
;
两个不管用的解决办法
DllCall("user32.dll","int","SendMessageTimeout","hwnd",65535,"int",26,"int",0,"int",0,"int",0,"int",1000,"str","dwResult")
DllCall("shell32.dll","none","SHChangeNotify","long",0x8000000,"int",0,"ptr",0,"ptr", 0)
求大虾帮解决!!!~~~ |
|