Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
BrowseForFolder
#1
How add: New Folder
#2
I found it: BIF_NEWDIALOGSTYLE 0x0040
#3
Make new function, eg BrowseForFolder2, and paste the following text. Call it with flag 4.

Code:
Copy      Help
;/
function# str&s [$initdir] [flags] [$text] ;;flags: 1 include files, 2 include non-file objects (Control Panel, etc), 4 new style

;Displays "Browse For Folder" dialog and stores full path of selected folder into s.
;Returns 1 on OK; 0 on Cancel.


;EXAMPLE
;str s
;if(BrowseForFolder(s "$windows$")) out s



;flags may also include one or more of the following commented values, lshifted by 8 bits. For example, to browse for computer, use 2|(0x1000<<8). For more info, search for SHBrowseForFolder in the MSDN Library.
def BIF_RETURNONLYFSDIRS 0x0001
;def BIF_DONTGOBELOWDOMAIN 0x0002
;def BIF_STATUSTEXT 0x0004
;def BIF_RETURNFSANCESTORS 0x0008

def BIF_EDITBOX 0x0010
;def BIF_VALIDATE 0x0020
def BIF_NEWDIALOGSTYLE 0x0040
def BIF_USENEWUI (BIF_NEWDIALOGSTYLE | BIF_EDITBOX)
;def BIF_BROWSEINCLUDEURLS 0x0080
;def BIF_UAHINT 0x0100
;def BIF_NONEWFOLDERBUTTON 0x0200
;def BIF_NOTRANSLATETARGETS 0x0400
;def BIF_BROWSEFORCOMPUTER 0x1000
;def BIF_BROWSEFORPRINTER 0x2000

def BIF_BROWSEINCLUDEFILES 0x4000
;def BIF_SHAREABLE 0x8000

BROWSEINFO b
b.hwndOwner=win()
if(flags&1) b.ulFlags|BIF_BROWSEINCLUDEFILES
if(flags&2=0) b.ulFlags|BIF_RETURNONLYFSDIRS
if(flags&4) b.ulFlags|BIF_USENEWUI
b.ulFlags|flags>>8
b.lpszTitle=text
if(len(initdir)) b.pidlRoot=PidlFromStr(initdir)

ITEMIDLIST* pidl=SHBrowseForFolder(&b)

if(pidl) PidlToStr(pidl &s flags&2=0); CoTaskMemFree pidl; else s.all
if(b.pidlRoot) CoTaskMemFree b.pidlRoot
ret s.len
#4
Thanks.


Forum Jump:


Users browsing this thread: 1 Guest(s)