Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BrowseFolder API

3 views
Skip to first unread message

FBxiii

unread,
Apr 16, 2010, 10:04:02 AM4/16/10
to
Hi. I want to be able to open the BrowseFolder window at a specified
directory eg - c:\Local Data\.

I have found some info on the internet but cant work out what I need to do.
Can anyone modify my code to do this please?

Cheers,
Steve.

Private 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

Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
"SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long

Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long

Private Const BIF_RETURNONLYFSDIRS = &H1


Public Function BrowseFolder(szDialogTitle As String, Optional strFolder As
String) As String
Dim X As Long, bi As BROWSEINFO, dwIList As Long
Dim szPath As String, wPos As Integer

With bi
.hOwner = hWndAccessApp
.lpszTitle = szDialogTitle
.ulFlags = BIF_RETURNONLYFSDIRS
End With

dwIList = SHBrowseForFolder(bi)
szPath = Space$(512)
X = SHGetPathFromIDList(ByVal dwIList, ByVal szPath)

If X Then
wPos = InStr(szPath, Chr(0))
BrowseFolder = Left$(szPath, wPos - 1)
If Right(BrowseFolder, 1) <> "\" Then BrowseFolder = BrowseFolder &
"\"
Else
BrowseFolder = vbNullString
End If
End Function

Douglas J. Steele

unread,
Apr 16, 2010, 10:16:00 AM4/16/10
to
Check what Stephen Lebans has at http://www.lebans.com/callbackbrowser.htm

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"FBxiii" <FBx...@discussions.microsoft.com> wrote in message
news:8D774151-C1BA-4E9D...@microsoft.com...

ruralguy via AccessMonster.com

unread,
Apr 16, 2010, 10:27:03 AM4/16/10
to
Follow this link:
http://www.lebans.com/callbackbrowser.htm

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201004/1

0 new messages