If anybody knows how to open a windows 2000 dialog that will enable the user to select a path or a folder (not files) please tell me how, I needed to know that yesterday.
thanks
Printable View
If anybody knows how to open a windows 2000 dialog that will enable the user to select a path or a folder (not files) please tell me how, I needed to know that yesterday.
thanks
Try this:
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 Private Sub Command1_Click() Msgbox BrowseForFolder(hWnd, "Select a Directory..") End Sub
Thanks I got the answer on aother thread so dont worry unless someone knows of a new 2000 one thanks