Results 1 to 2 of 2

Thread: Browse Network Dialog

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Dayton, OH USA
    Posts
    119

    Question

    How can I pull up a browse network dialog box? I found some code to bring up the browse folder dialog but that does not do it. A good example of what I am trying to do is similiar to when you map a drive in win2000 and click browse. It brings up a browse network dialog box and then returns a UNC path to a text box.

  2. #2
    Hyperactive Member compuGEEK's Avatar
    Join Date
    May 1999
    Location
    Mpls,MN,USA
    Posts
    281
    I had asked a similar question a while back. One of the Guru
    's answered me with this:

    In a module:
    Code:
    Private Type SHITEMID
    cb As Long
    abID As Byte
    End Type
    
    Private Type ITEMIDLIST
    mkid As SHITEMID
    End Type
    
    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 Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
    
    Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BROWSEINFO) As Long
    
    Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
    Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
    
    Private Const FLDR_NETWORK = &H12
    Private Const BIF_BROWSEFORCOMPUTER = 4096
    Public Function BrowseNetwork(ByVal lHwnd As Long, ByVal sTitle As String) As String
    
    Dim tIDL As ITEMIDLIST
    Dim lIDList As Long
    Dim sBuffer As String
    Dim tBI As BROWSEINFO
    Dim sComputer As String
    Dim lFolder As Long
    
    lret = SHGetSpecialFolderLocation(0, FLDR_NETWORK, tIDL)
    
    sComputer = Space(260)
    With tBI
    .hwndOwner = lHwnd
    .pIDLRoot = tIDL.mkid.cb
    .lpszTitle = lstrcat(sTitle, "")
    .ulFlags = BIF_BROWSEFORCOMPUTER
    .pszDisplayName = StrPtr(sComputer)
    End With
    
    lIDList = SHBrowseForFolder(tBI)
    sComputer = StrConv(sComputer, vbUnicode)
    BrowseNetwork = Left(sComputer, InStr(sComputer, Chr(0)) - 1)
    Call CoTaskMemFree(lIDList)
    End Function
    
    
    Private Sub Command1_Click()
    Caption = BrowseNetwork(hWnd, "Select a Computer..")
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width