07-31-2007, 04:26 PM
Hi,
I am trying to have a certain action happen if the user chooses cancel instead of ok.
It says in the code below that it return 0 on cancel but I don't know how to receive that value
The suggested syntax doesn't seem to have any return value for OK or Cancel..only for s
I totally know this is very basic but can you explain to me the logic behind using the statement the way you have it above
rather than just as
I have pasted the full function text below...
Thanks,
Stuart
[/code]
I am trying to have a certain action happen if the user chooses cancel instead of ok.
It says in the code below that it return 0 on cancel but I don't know how to receive that value
The suggested syntax doesn't seem to have any return value for OK or Cancel..only for s
I totally know this is very basic but can you explain to me the logic behind using the statement the way you have it above
rather than just as
I have pasted the full function text below...
Thanks,
Stuart
;/
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.
;flags may also include one or more of BIF_x flags (see function code), lshifted by 8 bits. For example, to browse for computer, use 2|(0x1000<<8). For more info, search for SHBrowseForFolder in the MSDN Library.
;EXAMPLE
;str s
;if(BrowseForFolder(s "$windows$")) out s
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(flags&4)
,STRINT p.i=flags; p.s.searchpath(initdir)
,b.lpfn=&BFF_Callback; b.lParam=&p
else 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