
SysTreeView32 or something to retrieve full MyComputer and Network Tree?
--------------6BB806962FF333F739658C6D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Can someone publish the Type "BrowseInfo" which belongs to the sample
below ?
(Public Declare Function SHBrowseForFolder Lib "shell32.dll" (lpbi As
BrowseInfo) As Long)
I couldn't find it in the API-Definitions
Thanks a lot
Stefan
Quote:
> Joel,
> You need to access the SHBrowseForFolder function located in the
> Shell32.DLL. This was demonstrated in the March (I think) issue of
> VBPJ.
> I have included the code as I typed it in from that article. I want
> to
> again state that the origins of this code is in the Q&A section of
> VBPJ.
> Enough of that, Here it is...
> '========================================================
> ' First this code should be placed in a Module
> '========================================================
> ' Public API Declares
> Public Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
> Public Declare Function SHBrowseForFolder Lib "shell32.dll" (lpbi As
> BrowseInfo) As Long
> Public Declare Function SHGetPathFromIDList Lib "shell32.dll" (ByVal
> pidList As Long, ByVal lpBuffer As String) As Long
> 'Public Interface
> Public Function BrowseForFolder(ByVal hWndOwner As Long, ByVal sPrompt
> As
> String) As String
> Dim iNull As Integer
> Dim lpIDList As Long
> Dim lResult As Long
> Dim sPath As String
> Dim udtBI As BrowseInfo
> With udtBI
> .hWndOwner = hWndOwner
> .lpszTitle = sPrompt
> .ulFlags = BIF_RETURNONLYFSDIRS
> End With
> lpIDList = SHBrowseForFolder(udtBI)
> If lpIDList Then
> sPath = Space$(MAX_PATH)
> lResult = SHGetPathFromIDList(lpIDList, sPath)
> Call CoTaskMemFree(lpIDList)
> iNull = InStr(sPath, vbNullChar)
> If iNull Then
> sPath = Left$(sPath, iNull - 1)
> End If
> End If
> BrowseForFolder = sPath
> End Function
> '========================================================
> ' To test the preceding code place a command button and a text box on
> the
> ' Startup form and add the following code to the Forms code module
> '========================================================
> Private Sub Command1_Click()
> Text1.Text = BrowseForFolder(Me.hWnd, "Choose a directory")
> End Sub
> For more tips, check out my web site at http://home.fia.net/~improg
> Good Luck
> --
> Thomas Harper
> Spam makes me STUTTER.
> Clean up the extra letters in the address above
> to E-Mail me
> > I am searching for a way to get the SysTreeview32 like in explorer.
> If
> > could only find a way to get the full directory tree under My
> Computer
> and
> > Network Neighbourhood, I would make the TreeView myself.
> > If anybody can shade some light, please I would apreciate.
> > By the way... I am using Visual Basic 5.
> > Thanks for any help.
> > --
> > _____________________
> > JOEL PAULA
> > "why he did not crane out to see
> > what lay beneath was perhaps because
> > the window was not made to open
> > or because he could or would not open it."
> > - Samuel Beckett - "stirrings still"
--------------6BB806962FF333F739658C6D
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
Can someone publish the Type "BrowseInfo" which belongs to the sample below
?
<BR>(Public Declare Function SHBrowseForFolder Lib "shell32.dll" (lpbi
As BrowseInfo) As Long)
<BR>I couldn't find it in the API-Definitions
<P>Thanks a lot
<BR>Stefan
<BR>
<BLOCKQUOTE TYPE=CITE>Joel,
<P>You need to access the SHBrowseForFolder function located in the
<BR>Shell32.DLL. This was demonstrated in the March (I think) issue
of VBPJ.
<BR>I have included the code as I typed it in from that article.
I want to
<BR>again state that the origins of this code is in the Q&A section
of VBPJ.
<P>Enough of that, Here it is...
<P>'========================================================
<BR>' First this code should be placed in a Module
<BR>'========================================================
<BR>' Public API Declares
<BR>Public Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
<BR>Public Declare Function SHBrowseForFolder Lib "shell32.dll" (lpbi As
<BR>BrowseInfo) As Long
<BR>Public Declare Function SHGetPathFromIDList Lib "shell32.dll" (ByVal
<BR>pidList As Long, ByVal lpBuffer As String) As Long
<P>'Public Interface
<BR>Public Function BrowseForFolder(ByVal hWndOwner As Long, ByVal sPrompt
As
<BR>String) As String
<BR> Dim iNull As Integer
<BR> Dim lpIDList As Long
<BR> Dim lResult As Long
<BR> Dim sPath As String
<BR> Dim udtBI As BrowseInfo
<P> With udtBI
<BR> .hWndOwner = hWndOwner
<BR> .lpszTitle = sPrompt
<BR> .ulFlags = BIF_RETURNONLYFSDIRS
<BR> End With
<P> lpIDList = SHBrowseForFolder(udtBI)
<BR> If lpIDList Then
<BR> sPath = Space$(MAX_PATH)
<BR> lResult = SHGetPathFromIDList(lpIDList,
sPath)
<BR> Call CoTaskMemFree(lpIDList)
<BR> iNull = InStr(sPath, vbNullChar)
<BR> If iNull Then
<BR>
sPath = Left$(sPath, iNull - 1)
<BR> End If
<BR> End If
<BR> BrowseForFolder = sPath
<BR>End Function
<P>'========================================================
<BR>' To test the preceding code place a command button and a text
box on the
<BR>' Startup form and add the following code to the Forms code module
<BR>'========================================================
<BR>Private Sub Command1_Click()
<BR> Text1.Text = BrowseForFolder(Me.hWnd, "Choose a
directory")
<BR>End Sub
<P>For more tips, check out my web site at <A HREF="http://home.fia.net/~improg">http://home.fia.net/~improg</A>
<P>Good Luck
<P>--
<BR>Thomas Harper
<BR>Spam makes me STUTTER.
<BR>Clean up the extra letters in the address above
<BR>to E-Mail me
<BR>> I am searching for a way to get the SysTreeview32 like in explorer.
If
<BR>> could only find a way to get the full directory tree under My Computer
<BR>and
<BR>> Network Neighbourhood, I would make the TreeView myself.
<BR>>
<BR>> If anybody can shade some light, please I would apreciate.
<BR>> By the way... I am using Visual Basic 5.
<BR>> Thanks for any help.
<BR>>
<BR>> --
<BR>> _____________________
<BR>> JOEL PAULA
<BR>> "why he did not crane out to see
<BR>> what lay beneath was perhaps because
<BR>> the window was not made to open
<BR>> or because he could or would not open it."
<BR>> - Samuel Beckett - "stirrings still"
<BR>></BLOCKQUOTE>
</HTML>
--------------6BB806962FF333F739658C6D--