Results 1 to 7 of 7

Thread: DriveListBox question

  1. #1

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    DriveListBox question

    Ok,

    I have a drive list box, which unfortunately, does not show network drives available .

    The drive list box (along with its tied in dir listbox), need to be able to browse the network so a user can point my program to a directory containing data files on the network.

    I searched the forum for similiar questions, and people responded about Mapping a network drive, however, I am not sure how to do so. Can this be done runtime, or does an Administrator have to set this?

  2. #2
    dj@phrodite
    Guest
    have you already tried "//network_location" as the source for the listbox?

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    First, the DriveListBox will only show those drives that currently exist, or are actually mapped. Its easy to map a drive
    VB Code:
    1. Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
    2.  
    3. 'Description
    4. 'Here \\vdk00005\proj is the name of the network path
    5. 'H: is the Drive Letter
    6. 'Map Network Drive (Connect)
    7. WNetAddConnection "\\vdk00005\proj", "", "H:"

  4. #4

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    If I set the location manually in code, yes, that works. But I need to be able to have the user select the drive. I guess what I mean is, my computer does not have the other networked computer hard drive mapped, only a shortcut on my desktop.

    So should my program try mapping the drive, or should I leave it to the customer's administrator to map the drive, and then it will automatically show up in the DirListBox...

    As you can tell, I know little about mapping a network drive, or really what that means...

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Then, show them this
    VB Code:
    1. Private Declare Function WNetConnectionDialog Lib "mpr.dll" (ByVal hwnd As Long, ByVal dwType As Long) As Long
    2.  
    3. Private Sub Command1_Click()
    4. Call WNetConnectionDialog(Me.hwnd, 1)
    5. End Sub

  6. #6

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Awesome !

    Thank you Hack!

    One further question, what does reconnect at login mean? Does that mean the user won't have to remap a drive at login?

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Yes. Thats what it means. I don't know whether you need this or not, but here is the Disconnect box as well.
    VB Code:
    1. Private Declare Function WNetDisconnectDialog Lib "mpr.dll" Alias "WNetDisconnectDialog" (ByVal hwnd As Long, ByVal dwType As Long) As Long
    2.  
    3. Private Sub Command1_Click()
    4. Call WNetDisconnectDialog(Me.hwnd, 1)
    5. 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