Anyone know how to make a Windows folder display in a specific view? I want to open in "Medium icons" view (like below) for a specific folder, but it would be good to be able to switch to the other views as well. Thanks!
Note: I can probably do it with keystrokes as though the user did it, but that's just an ugly hack. I'd prefer a clean SendMessage (or however it's done) method, if possible.
Set folder view?
Re: Set folder view?
Bump in case this got overlooked. (If not, all good, but just reminding).
Re: Set folder view?
Not exactly the same but at least it works
Adapt it for your needs
Adapt it for your needs
Code: Select all
;#LARGE_ICON = 28713
#MEDIUM_ICON = 28714
#LIST = 28715
#DETAILS = 28716
;#THUMBS = 28717
#TILES = 28718
#DETALS4DETAILS = 28723
Procedure hookCB(hWnd, uMsg, wParam, lParam)
Protected *NMHdr.NMHDR
If uMsg = #WM_NOTIFY
*NMHdr = LParam
If *NMHdr\code = #CDN_FOLDERCHANGE
hWnd = FindWindowEx_(GetParent_(hWnd), 0, "ShellDll_DefView", 0)
If hWnd
SendMessage_(hWnd, #WM_COMMAND, #MEDIUM_ICON, 0)
EndIf
EndIf
EndIf
EndProcedure
Define Filename.S{#MAX_PATH}
Define OFN.OPENFILENAME
OFN\lStructSize = SizeOf(OPENFILENAME)
OFN\lpstrFile = @"C:\users\mmras\*.*"
OFN\nMaxFile = #MAX_PATH
OFN\Flags = #OFN_EXPLORER | #OFN_ENABLESIZING | #OFN_FILEMUSTEXIST | #OFN_ENABLEHOOK
OFN\lpfnHook = @hookCB()
GetOpenFileName_(OFN)
Repeat
ForEver
Egypt my love
Re: Set folder view?
Hi Rashad! Your code works for prompts, but I can't make it work with an existing open folder in Explorer?
Code: Select all
#MEDIUM_ICON=28714
Sleep_(2000) ; So I can click an existing Explorer window.
fg=GetForegroundWindow_()
hWnd=FindWindowEx_(GetParent_(fg),0,"ShellDll_DefView",0)
SendMessage_(hWnd,#WM_COMMAND,#MEDIUM_ICON,0) ; No change. :(