Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Select path in windows explorer
#1
how do i navigate to another directory in an existing windows explorer window ?

i tried open folder with no success so far (can't find the right combination).

there must be a better way than my acc tricks.

targets
Code:
Copy      Help
/
function $string1 mode [menu] ;; string path - mode 1=explorer 2=filedialog
int i hwnd=win()
if mode = 1
,mode=win("" "ExploreWClass")

str path.expandpath(string1)
str txt
str cla.getwinclass(mode)
int rx ry rw rh; GetWinXY hwnd rx ry rw rh
sel cla
,case "ExploreWClass"
,,,act mode
,,,path.setwintext(child("" "Edit" mode 0x5))
,,,act child("" "Edit" mode 0x5)
,,,key Y
,,
,case "#32770"
,,Acc b=acc("Dateiname:" "TEXT" hwnd "Edit" "" 0x1801 0x0 0x20000040)
,,str selected=b.Value
,,if len(b.Value)=0
,,,b.SetValue(path)
,,,but id(1 hwnd)
,,,b.SetValue("")
,,else
,,,b.SetValue(path)
,,,but id(1 hwnd)
,,,b.SetValue(selected)

ret
pi
#2
Function OpenFolder
Code:
Copy      Help
;/
function hwnd $folder

;Opens folder in existing Windows Explorer window.

;EXAMPLES
;OpenFolder win("" "ExploreWClass") "$desktop$"
;OpenFolder win("" "ExploreWClass") ":: 14001F50E04FD020EA3A6910A2D808002B30309D" ;;My Computer



SHDocVw.InternetExplorer f=GetFolderInterface(hwnd)
if(!f) end ES_FAILED
VARIANT v
str s.expandpath(folder)
if(s.beg(":: "))
#if _winnt>=5
,dll shell32 #ILGetSize ITEMIDLIST*pidl
,ITEMIDLIST* il=PidlFromStr(s)
,int ils=ILGetSize(il)
,ARRAY(byte) a.create(ils)
,memcpy(&a[0] il ils)
,CoTaskMemFree(il)
,v.attach(a)
#else
,ret
#endif
else v=s
f.Navigate2(v)

Function GetFolderInterface
Code:
Copy      Help
;/
function'SHDocVw.InternetExplorer hwnd

;Returns InternetExplorer interface of Windows Explorer window.


SHDocVw.ShellWindows sw._create
SHDocVw.InternetExplorer ie
foreach(ie sw)
,int h=ie.HWND; err continue
,if(h=hwnd) ret ie
#3
WOW !!!

thanks.
pi
#4
and what about filedialog ?

thanks
pi
#5
It is easy. Paste the path into the combo box and press Open.
#6
I tried this set of functions and received the following error, not able to debug

Error (RT) in GetFolderInterface: 0x80004005, Unspecified error

pointer hits the "if" in this line of code
Code:
Copy      Help
foreach(ie sw) if(ie.HWND=hwnd) ret ie

Your guidance would be appreciated

Thanks

Carl
#7
I added err. Now should work.
#8
Got it, I was looking for an explorer window to open and it was actually presenting an explorer view in Firefox. It appears to be looking for an open class as sometimes it would show the window in Outlook. I just need to figure out how to control the function so it opens an explorer window rather than a browser or Outlook one.

carl
#9
Function OpenFolder does not open new windows. It shows the folder in existing window. Window class should be "ExploreWClass" or "CabinetWClass". It also can be Internet Explorer.
#10
Thanks very much. I am still something of a n00b at QM so every little bit helps.

carl


Forum Jump:


Users browsing this thread: 1 Guest(s)