In Windows XP, you could hide the File Explorer file tree, but windows 10 doesn't have such a button. It turns out that you can change the flag in the registry and the file tree will be hidden for newly opened folders.
To do this, I made a switch that is inserted into the folder menu.
In the registry, in the section "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Modules\GlobalSettings\Sizer", the parameter "PageSpaceControlSizer" binary data in position 5 is the flag display navigation bar (1) or not (0).
Code: Select all
EnableExplicit
XIncludeFile "Registry.pbi"
UseModule Registry
Define flgNav.b
Define Pos.b
Define Param$
Define RegValue.RegValue
RegValue\TYPE = #REG_BINARY
Define Key$ = "\Software\Microsoft\Windows\CurrentVersion\Explorer\Modules\GlobalSettings\Sizer"
Param$ = ProgramParameter()
If FileSize(Param$) = -2 ; если папка, то
If Right(Param$, 1) <> #PS$
Param$ + #PS$
EndIf
Else
Param$ = ""
EndIf
RegValue.RegValue
RegValue\TYPE = #REG_BINARY
ReadValue(#HKEY_CURRENT_USER, Key$, "PageSpaceControlSizer", #False, RegValue)
If RegValue\SIZE >= 5
flgNav = PeekB(RegValue\BINARY + 4)
If flgNav
PokeB(RegValue\BINARY + 4, 0)
Else
PokeB(RegValue\BINARY + 4, 1)
EndIf
WriteValue(#HKEY_CURRENT_USER, Key$, "PageSpaceControlSizer", "", #REG_BINARY, #False, RegValue)
Else
End
EndIf
ClearStructure(RegValue, RegValue)
; Возвращает путь к EXE-файлу запущенного процесса зная его дескриптор окна или PID
Procedure.s ProcessNameFromHwnd(hWnd)
Protected PID, psapi_dll, Path$, GetModuleFileNameEx, hProcess
psapi_dll = OpenLibrary(#PB_Any, "psapi.dll")
If psapi_dll
GetModuleFileNameEx = GetFunction(psapi_dll, "GetModuleFileNameExW") ; Только имена путей в Юникоде!
If GetModuleFileNameEx
If GetWindowThreadProcessId_(hWnd, @PID)
hProcess = OpenProcess_(#PROCESS_QUERY_INFORMATION | #PROCESS_VM_READ, #Null, PID)
If hProcess
Path$ = Space(#MAX_PATH)
If Not CallFunctionFast(GetModuleFileNameEx, hProcess, #Null, @Path$, #MAX_PATH)
Path$ = ""
EndIf
CloseHandle_(hProcess)
EndIf
EndIf
EndIf
CloseLibrary(psapi_dll)
EndIf
ProcedureReturn Path$
EndProcedure
Define hWnd, Text$, k
Global hWnd_Find, classText.s = Space(256)
Procedure enumChildren1(hwnd, k)
If hwnd
GetClassName_(hwnd, @classText, 256)
If GetDlgCtrlID_(hwnd) = 1001 And classText = "ToolbarWindow32"
hWnd_Find = hwnd
ProcedureReturn 0
EndIf
ProcedureReturn 1
EndIf
ProcedureReturn 0
EndProcedure
If Asc(Param$)
RunProgram("explorer", Param$, "")
Else
hWnd = FindWindowEx_(0, 0, "CabinetWClass", 0) ; поиск окна по классу
If hWnd ;And Right(ProcessNameFromHwnd(hWnd), 13) = "\explorer.exe"
EnumChildWindows_(hWnd, @enumChildren1(), k)
If hWnd_Find
Text$ = Space(256)
SendMessage_(hWnd_Find, #WM_GETTEXT, 256, @Text$)
EndIf
EndIf
; RunProgram("explorer", "/Select, " + Mid(Text$, 8), "")
Pos = FindString(Text$, "\")
If Pos
Text$ = Mid(Text$, Pos - 2)
; Debug Text$
If FileSize(Text$) = -2
RunProgram("explorer", Text$, "")
EndIf
EndIf
EndIf
Code: Select all
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\Toggle tree display\command]
@="\"C:\\nopan\\toggle_pan.exe\" \"%1\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\Toggle tree display\command]
@="\"C:\\nopan\\toggle_pan.exe\" \"%V\""