Results 1 to 2 of 2

Thread: Map Network Drive

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344

    Red face

    How would i go about mapping \\lab_techs\c\ when my program starts up? If possible assign it to letter T but if you just know how to map that directory it would be a big help thanks.
    -RaY
    VB .Net 2010 (Ultimate)

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Posts
    114

    map

    This may help you. Create a new form and add 4 buttons. Here are the names and captions of the buttons:

    Command1(0) - caption = "Connect Drive"
    Command1(1) - caption = "Disconnect Drive"
    Command1(2) - caption = "Quit
    PrinterButton - caption = "End Capture"

    Now add the code below -



    Option Explicit

    Private Declare Function WNetConnectionDialog Lib "mpr.dll" (ByVal hwnd As Long, ByVal dwType As Long) As Long


    Private Declare Function WNetDisconnectDialog Lib "mpr.dll" (ByVal hwnd As Long, ByVal dwType As Long) As Long
    Const RESOURCETYPE_DISK = &H1, RESOURCETYPE_PRINT = 0





    Private Sub Command1_Click(Index As Integer)
    Dim x As Long


    If Index = 0 Then 'Connect
    x = WNetConnectionDialog(Me.hwnd, RESOURCETYPE_DISK)
    ElseIf Index = 1 Then 'Disconnect
    x = WNetDisconnectDialog(Me.hwnd, RESOURCETYPE_DISK)
    Else
    End
    End If

    End Sub

    Private Sub PrinterButton_Click()
    Dim x As Long
    x = WNetDisconnectDialog(Me.hwnd, RESOURCETYPE_PRINT)

    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