|
-
Mar 17th, 2005, 07:00 PM
#1
Thread Starter
Addicted Member
Re: ARR! Directories....
Aww man that kicks ass lol what would be the code similar to that but to browse for directory
-
Mar 17th, 2005, 07:10 PM
#2
-
Mar 17th, 2005, 07:21 PM
#3
Thread Starter
Addicted Member
Re: ARR! Directories....
no, can you tell me anyway to select a directory and display the path in a textbox?
-
Mar 17th, 2005, 07:31 PM
#4
Re: ARR! Directories....
well, i do it like this
If Dir$(App.Path & "\saveto.txt") <> "" Then
msgbox "brtar"
-
Mar 17th, 2005, 07:33 PM
#5
Thread Starter
Addicted Member
Re: ARR! Directories....
i dont get how that will let the user browse for a specific folder, but ill play around with that code
-
Mar 17th, 2005, 07:50 PM
#6
Re: ARR! Directories....
Add the following code to a module.
VB Code:
Private Declare Function SHBrowseForFolder _
Lib "shell32" ( _
lpbi As BROWSEINFO) As Long
Private Declare Function SHGetPathFromIDList _
Lib "shell32" ( _
ByVal pidList As Long, _
ByVal lpBuffer As String) As Long
Private Type BROWSEINFO
hWndOwner As Long
pIDLRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Private Const BIF_RETURNONLYFSDIRS = 1
Private Const BIF_DONTGOBELOWDOMAIN = 2
Private Const MAX_PATH = 260
Public Function BrowseForFolder(OwnerForm As Form) As String
Dim lpIDList As Long
Dim sBuffer As String
Dim tBrowseInfo As BROWSEINFO
With tBrowseInfo
.pszDisplayName = Space$(MAX_PATH)
.lpszTitle = "Select a folder"
.hWndOwner = OwnerForm.hWnd
.ulFlags = BIF_DONTGOBELOWDOMAIN + BIF_RETURNONLYFSDIRS
End With
lpIDList = SHBrowseForFolder(tBrowseInfo)
If (lpIDList) Then
sBuffer = Space(MAX_PATH)
SHGetPathFromIDList lpIDList, sBuffer
BrowseForFolder = Left$(sBuffer, InStr(sBuffer, vbNullChar) - 1)
End If
End Function
You can then get a folder name by doing the following call from inside your form somewhere:
VB Code:
MsgBox BrowseForFolder(Me)
Last edited by Joacim Andersson; Mar 17th, 2005 at 07:54 PM.
-
Mar 17th, 2005, 08:12 PM
#7
Re: ARR! Directories....
no, can you tell me anyway to select a directory and display the path in a textbox?
what i said selects the dir, and you can see if it exists. If it does then you can do some stuff with it
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
|