-
I know this may sound stupid, but does anyone know what component Windows Explorer uses for browsing the files? I have been looking all over for it in Visual Basic and C++, but nothing. I think it is named something like SysTreeView32 or something like that.
This is really important that I have this, so any help would be appreciated. :)
-
<?>
Code:
'using the browser dialog box
'make a reference
Option Explicit
Private Const BIF_RETURNONLYFSDIRS = 1
Private Const BIF_DONTGOBELOWDOMAIN = 2
Private Const MAX_PATH = 260
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 Declare Function lstrcat Lib "kernel32" _
Alias "lstrcatA" (ByVal lpString1 As String, ByVal _
lpString2 As String) As Long
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 Sub Form_Load()
'Opens a Browse Folders Dialog Box that displays the
'directories in your computer
Dim lpIDList As Long ' Declare Varibles
Dim sBuffer As String
Dim szTitle As String
Dim tBrowseInfo As BrowseInfo
szTitle = "Hello World. Click on a directory and " & _
"it's path will be displayed in a message box"
' Text to appear in the the gray area under the title bar
' telling you what to do
With tBrowseInfo
.hWndOwner = Me.hWnd ' Owner Form
.lpszTitle = lstrcat(szTitle, "")
.ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN
End With
lpIDList = SHBrowseForFolder(tBrowseInfo)
If (lpIDList) Then
sBuffer = Space(MAX_PATH)
SHGetPathFromIDList lpIDList, sBuffer
sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)
' <<< Add Your Code Here >>>
MsgBox sBuffer
End If
End Sub
-
Thanks for your reply, but I guess I wasn't being specific enough. Let me try to explain more.
What I need is the treeview control that is used in Open/Save dialog boxes to browse the folders and files.
I need this because I am making a program that uses that control. Thanks for your help.
-
CommonDialog Control?
Are you familiar with the CommonDialog Control? This could be what you need.
I use it when I want to open and/or save files from a VB application. It will also provide a pallatte for runtime user selection of colors.
I have it on my Toolbar in the design environment, and have forgotten exactly how I put it there. If you cannot figure it out, I think I can figure it out again and also provide some simple code which uses it.
I think MSDN library & VB help has something on CommonDialog Control.
-
Thanks Guv, for your reply
But I am ONLY looking for the treeview component that is contained INSIDE of the open/save dialog boxes. If anyone has an idea of how to implement JUST that control into an application, I would be most grateful.
-
I think you are going to have to pound on microsoft's door for a bit in hopes of them releasing it, because to my knowledge there is no one control that does that you would have to use a treeview and some serious code to do it. Let me know if I'm wrong.