|
-
Feb 21st, 2002, 07:54 PM
#1
Thread Starter
Frenzied Member
easy folder choosing?
how do i access the ms folder chooser? u know, the one that is already programed and has desktop, my documents etc. and has no file display/choosing
-
Feb 21st, 2002, 07:58 PM
#2
In all the years I've dealth with various versions of Windows, I've never heard of a "folder chooser".
What the heck are you talking about?
-
Feb 21st, 2002, 08:05 PM
#3
You can use the SHBrowseForFolder() and associated API, i.e.
In a Standard Module:
VB Code:
Option Explicit
Private 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
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lStrCat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
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 Const BIF_RETURNONLYFSDIRS = 1
Public Function BrowseForFolder(ByVal lHwnd As Long, ByVal sPrompt As String) As String
Dim tBI As BROWSEINFO
Dim lList As Long
Dim lResult As Long
Dim sPath As String
Dim sString As String
sString = Space(260)
With tBI
.hwndOwner = lHwnd
.lpszTitle = lStrCat(sPrompt, Chr(0))
.pszDisplayName = StrPtr(sString)
.ulFlags = BIF_RETURNONLYFSDIRS
End With
lList = SHBrowseForFolder(tBI)
sString = StrConv(sString, vbUnicode)
If lList Then
sPath = Space(260)
lResult = SHGetPathFromIDList(lList, sPath)
Call CoTaskMemFree(lList)
sPath = Left$(sPath, InStr(sPath, Chr(0)) - 1)
End If
BrowseForFolder = sPath
End Function
Example Usage:
VB Code:
Private Sub Command1_Click()
Caption = BrowseForFolder(hWnd, "Select Directory..")
End Sub
-
Feb 21st, 2002, 08:09 PM
#4
Thread Starter
Frenzied Member
thanks aaron!!!!
folder chooser was MY name for it, but i think it was pretty clear what i was looking for by the description
-
Feb 21st, 2002, 08:27 PM
#5
Originally posted by dis1411
but i think it was pretty clear what i was looking for by the description
Quite the contrary. It is a testament to Aaron Young's imagination that he had a clue what you were talking about.
Aaron: You are a mind reading genius. I've gone over dis1411 until I can recite it from memory. How did you know what the heck he was talking about?
-
Feb 21st, 2002, 08:33 PM
#6
I worked as the sole tech-support for a company of 250+ users for just over 2 years... You learn to read between the lines.
-
Feb 21st, 2002, 08:42 PM
#7
This probably doesn't mean anything to you Aaron, but you just got 3 stars in my book of respect!!!
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
|