Aug 28th, 2001, 10:02 AM
#1
Thread Starter
Lively Member
Aug 28th, 2001, 10:07 AM
#2
Aug 28th, 2001, 10:11 AM
#3
Addicted Member
Browse Path
I'm sending you an example of one of the forms I used in one of my applications to browse for a path
Attached Files
Aug 28th, 2001, 10:13 AM
#4
Frenzied Member
Here:
Put this in a module, or if you want it on a form, add Private where appropriate:
VB Code:
Option Explicit
'Dir Select code
Const BIF_RETURNONLYFSDIRS = 1
Const BIF_DONTGOBELOWDOMAIN = 2
Const MAX_PATH = 260
Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Type BrowseInfo
hWndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Function DirSelect() As String
'Dir Select dialog code:
Dim lpIDList As Long
Dim sBuffer As String
Dim szTitle As String
Dim tBrowseInfo As BrowseInfo
szTitle = "Choose Folder"
With tBrowseInfo
.hWndOwner = Form1.hWnd
.lpszTitle = lstrcat(szTitle, "")
.ulFlags = BIF_DONTGOBELOWDOMAIN + BIF_RETURNONLYFSDIRS
End With
lpIDList = SHBrowseForFolder(tBrowseInfo)
If (lpIDList) Then
sBuffer = Space(MAX_PATH)
SHGetPathFromIDList lpIDList, sBuffer
'sBuffer value is the directory that the user choose from the dialog.
sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)
DirSelect = sBuffer
End If
End Function
Just call the DirSelect function and it will display the dialog and return the path of the dir.
You just proved that sig advertisements work.
Aug 28th, 2001, 01:28 PM
#5
Thread Starter
Lively Member
thanks all.
nishantp how would I make it open center owner?
Don't ever Ginop before you Ginip
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width