?
Solved

Drive List with Mapped Network Drives and My Network Places

Posted on 2003-03-24
7
Medium Priority
?
205 Views
Last Modified: 2010-04-07
How do I get the Drive List Box to show all the 'common' things that show up in other applictations, such as My Documents, Desktop, and more importantly Mapped Network Drives and My Network Places?
0
Comment
Question by:tristan256
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 5

Accepted Solution

by:
Cimperiali earned 200 total points
ID: 8193886
if you want it to look similar to the explorer, you have to use an imagecombo and load items in it using filesystemoBject to detect the drives and the special folders.
A really easier one is to use the ShBrowseForFoler Api:
From api-guide (a free tool you can download at http://www.allapi.net)

Requires Windows NT 4.0 or later; Requires Windows 95 or later
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
Const BIF_RETURNONLYFSDIRS = 1
Const MAX_PATH = 260
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 Sub Form_Load()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'KPDTeam@Allapi.net
    Dim iNull As Integer, lpIDList As Long, lResult As Long
    Dim sPath As String, udtBI As BrowseInfo

    With udtBI
        'Set the owner window
        .hWndOwner = Me.hWnd
        'lstrcat appends the two strings and returns the memory address
        .lpszTitle = lstrcat("Choose a Folder", "")
        'Return only if the user selected a directory
        .ulFlags = BIF_RETURNONLYFSDIRS
    End With

    'Show the 'Browse for folder' dialog
    lpIDList = SHBrowseForFolder(udtBI)
    If lpIDList Then
        sPath = String$(MAX_PATH, 0)
        'Get the path from the IDList
        SHGetPathFromIDList lpIDList, sPath
        'free the block of memory
        CoTaskMemFree lpIDList
        iNull = InStr(sPath, vbNullChar)
        If iNull Then
            sPath = Left$(sPath, iNull - 1)
        End If
    End If

    MsgBox sPath
End Sub
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 8194078
You might find the common dialog control a bit easier.

I use this function in a form with the control on it.

Public Function FileBrowse(Message As String, Expectedpath As String, DefaultName As String, FilePattern As String, Save As Boolean) As String
Dim NewFileName As String
    On Error GoTo FileBrowseError
    Me.CommonDialog1.CancelError = True
    Me.CommonDialog1.FileName = DefaultName
    Me.CommonDialog1.InitDir = Expectedpath
    Me.CommonDialog1.DialogTitle = App.Title & " - " & Message
    Me.CommonDialog1.FilterIndex = 1
    Me.CommonDialog1.Filter = FilePattern
    If Save Then
        Me.CommonDialog1.Flags = 0 Or cdlOFNHideReadOnly
        Me.CommonDialog1.ShowOpen
    Else
        Me.CommonDialog1.Flags = 0 Or cdlOFNFileMustExist Or cdlOFNHideReadOnly Or cdlOFNReadOnly
        Me.CommonDialog1.ShowOpen
    End If
    FileBrowse = Me.CommonDialog1.FileName
FileBrowseError:
    Exit Function
End Function

0
 

Expert Comment

by:CleanupPing
ID: 8531750
Hi tristan256,
This old question (QID 20560666) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Expert Comment

by:Sethi
ID: 9391406
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
[Accept Cimperiali's comment as Answer]
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

[Sethi]
EE Cleanup Volunteer
0
 
LVL 5

Expert Comment

by:Cimperiali
ID: 9391521
Let me suggest to split points with GrahamSkan, as also his answer is a solution that can work.
Cesare Imperiali
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 9391559
Thank you Cesare. If I were cleaning up, I'd have made the same recommendation that Sethi did. You were the first to give a viable solution, and there are only 50 points to split. But it's nice to be recognised
Graham
0
 
LVL 5

Expert Comment

by:Cimperiali
ID: 9392379
;-)
Have a nice day, Graham

Cesare
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question