Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing Folder View in ActiveX WebBrowser in Dlg
#14
1. Tested double-click:
On Windows 10 opens folder in the same dialog/control, not in Windows Explorer.
On Windows 7 - in Windows Explorer.
On XP - nowhere.

Try to somehow disable opening by double-clicking and instead call Navigate.

I think that these COM interfaces are unreliable, limited, almost undocumented, and perhaps deprecated. But I don't know another easy way to display a folder in a dialog.

2. It seems need to set events when current folder changed.

Function dlg_folder_view
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 441 374 "Form"
;3 ActiveX 0x54000000 0x0 0 20 440 352 "SHDocVw.WebBrowser"
;4 ComboBox 0x54230243 0x0 2 4 96 213 ""
;5 Button 0x54032000 0x0 116 2 64 14 "Open selected"
;6 Edit 0x44000080 0x200 236 2 96 14 ""
;7 Button 0x54032000 0x0 182 2 48 14 "Up"
;1 Button 0x54030001 0x0 338 2 48 14 "OK"
;2 Button 0x54030000 0x0 388 2 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040100 "" "" "" ""

str controls = "3 4 6"
str ax3SHD cb4 e6
cb4="FVM_ICON[]FVM_SMALLICON[]FVM_LIST[]FVM_DETAILS[]FVM_THUMBNAIL[]FVM_TILE[]FVM_THUMBSTRIP"; if(_winver>=0x601) cb4+"[]FVM_CONTENT"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
out e6


#sub DlgProc
function# hDlg message wParam lParam
SHDocVw.WebBrowser we3
Shell32.ShellFolderView fv
Shell32.FolderItem fi
sel message
,case WM_INITDIALOG
,we3._getcontrol(id(3 hDlg))
,we3._setevents("sub.we3") ;;need DocumentComplete event
,
,;initial folder
,we3.Navigate(_s.expandpath("$personal$"))
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
we3._getcontrol(id(3 hDlg))
sel wParam
,case CBN_SELENDOK<<16|4
,_i=CB_SelectedItem(lParam)+1
,fv=we3.Document
,fv.CurrentViewMode=_i
,
,case 5 ;;open selected
,fv=we3.Document
,fi=fv.FocusedItem
,;out fi.Path
,if fi.IsFolder
,,we3.Navigate(fi.Path)
,else
,,fi.InvokeVerb
,
,case 7 ;;Up
,;we3.GoBack ;;error
,;we3.ExecWB ?
,_s=we3.LocationURL
,_s.getpath
,we3.Navigate(_s)
,
,case IDOK
,;get path of selected item
,fv=we3.Document
,fi=fv.FocusedItem
,str path=fi.Path
,;out path
,path.setwintext(id(6 hDlg))
,
ret 1


#sub we3_DocumentComplete
function IDispatch'pDisp `&URL SHDocVw.IWebBrowser2'we3
;out __FUNCTION__
Shell32.ShellFolderView fv=we3.Document
fv._setevents("sub.fv")


#sub fv_SelectionChanged
function Shell32.IShellFolderViewDual3'fv
Shell32.FolderItem fi=fv.FocusedItem
str path=fi.Path
out path


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)