Hi,
Patrick
Thanks
for the hint about the windows API.
I can use SHBrowseForFolder of windows API to
browse the directory.
I put
the code here for anyone interested in.
Thanks
you all. / dan
'
***************************************************************************
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
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
Const BIF_RETURNONLYFSDIRS = 1
Const BIF_DONTGOBELOWDOMAIN = 2
Const MAX_PATH = 260
Declare Function
SHBrowseForFolder Lib "shell32"
_
(lpbi As BrowseInfo) As Long
(lpbi As BrowseInfo) As Long
Declare Function
SHGetPathFromIDList Lib "shell32"
_
(ByVal pidList As Long, _
ByVal lpBuffer As String) As Long
(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
(ByVal lpString1 As String, ByVal _
lpString2 As String) As Long
Sub
Main
'Opens a Treeview control that displays the directories in a computer
Dim RoseHWND As HWND
Set RoseHWND = WinFind("Rational Rose")
'Opens a Treeview control that displays the directories in a computer
Dim RoseHWND As HWND
Set RoseHWND = WinFind("Rational Rose")
Dim
lpIDList As Long
Dim sBuffer As String
Dim szTitle As String
Dim tBrowseInfo As BrowseInfo
Dim sBuffer As String
Dim szTitle As String
Dim tBrowseInfo As BrowseInfo
Dim tmp As
String
szTitle = "This is the
title"
tBrowseInfo.hWndOwner = RoseHWND.value
tBrowseInfo.lpszTitle = lstrcat(szTitle, "")
tBrowseInfo.ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN
tBrowseInfo.hWndOwner = RoseHWND.value
tBrowseInfo.lpszTitle = lstrcat(szTitle, "")
tBrowseInfo.ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN
lpIDList = SHBrowseForFolder(tBrowseInfo)
If
(lpIDList) Then
tmp = Space(MAX_PATH)
sBuffer = Space(MAX_PATH)
tmp = SHGetPathFromIDList (lpIDList, sBuffer)
sBuffer = Left(sBuffer, InStr(sBuffer, chr$(0)) - 1)
MsgBox sBuffer
End If
End Sub
' ************************************************************************************************
tmp = Space(MAX_PATH)
sBuffer = Space(MAX_PATH)
tmp = SHGetPathFromIDList (lpIDList, sBuffer)
sBuffer = Left(sBuffer, InStr(sBuffer, chr$(0)) - 1)
MsgBox sBuffer
End If
End Sub
' ************************************************************************************************
