Select Folder - From Api

Have you ever wanted to show user that dialog which allows to select ONLY THE
FOLDER to save files? Well, this piece of code can do that for you. I've put
this and a lot of others functions API functions in a script library, i don't
need to tell you why...
Put the first part in Declarations Section, and the rest as a function, that
returns the path selected. It's perfect when you need to select ONLY A FOLDER,
and not a file.
Have fun...
'--------------------------------------------------
'BrowseFolder
'--------------------------------------------------
Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias
"SHGetPathFromIDListA" (Byval pidl As Long, Byval pszPath As String) As Long
Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA"
(lpBrowseInfo As BROWSEINFO) As Long


Function BrowseFolder (path As String, windowtitle As String) As String

Dim X As Long, bi As BROWSEINFO, dwIList As Long
Dim wPos As Integer
Dim cam2 As String

bi.pszDisplayName = path
bi.hOwner = hWndAccessApp
bi.lpszTitle = title
bi.ulFlags = BIF_RETURNONLYFSDIRS

dwIList = SHBrowseForFolder (bi)
cam2 = Space$(512)
X = SHGetPathFromIDList(Byval dwIList, Byval cam2)

If X Then
wPos = Instr (cam2, Chr(0))
BrowseFolder = Left$ (cam2, wPos - 1)
Else
BrowseFolder = ""
End If

End Function





Example:

Sub Click (Source As Button)

Dim session As New notessession
Dim wk As New notesuiworkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim folder As String
Set uidoc = wk.CurrentDocument
Set doc = uidoc.Document
folder = BrowseFolder (doc.CERT_Destination(0), "Choose the folder to save
ID File:")
If folder <> "" Then
Call uidoc.FieldSetText ("CERT_Destination", folder + "\")
Call session.SetEnvironmentVar ("CERT_Destination", folder + "\")
End If

End Sub
This was first published in November 2000

Dig deeper on Domino Resources - Part 7

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close