$Form1 = GUICreate("显示或隐藏文件和文件夹", 266, 81, -1, -1)
$Button1 = GUICtrlCreateButton("显示文件", 36, 24, 89, 33)
$Button2 = GUICtrlCreateButton("隐藏文件", 140, 24, 89, 33)
GUISetState(@SW_SHOW)
Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUICtrlSetOnEvent($Button1, "Install")
GUICtrlSetOnEvent($Button2, "Uninstall")
While 1
Sleep(100)
WEnd
Func _Exit()
Exit
EndFunc ;==>_Exit
Func Install()
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "REG_DWORD", "1")
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSuperHidden", "REG_DWORD", "1")
DllCall("shell32.dll", "none", "SHChangeNotify", "long", 0x8000000, "int", 0, "ptr", 0, "ptr", 0)
MsgBox(0, "", "显示文件成功", 3)
EndFunc ;==>Install
Func Uninstall()
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "REG_DWORD", "2")
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSuperHidden", "REG_DWORD", "0")
DllCall("shell32.dll", "none", "SHChangeNotify", "long", 0x8000000, "int", 0, "ptr", 0, "ptr", 0)
MsgBox(0, "", "隐藏文件成功", 3)
EndFunc ;==>Uninstall