VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



MAP NETWORK DRIVE WITH VB

by LEVENT YILDIZ (3 Submissions)
Category: Windows System Services
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (11 Votes)

Well the simple way to map network drives with vb.

API Declarations
Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
Declare Function WNetCancelConnection Lib "mpr.dll" Alias "WNetCancelConnectionA" (ByVal lpszName As String, ByVal bForce As Long) As Long

Rate MAP NETWORK DRIVE WITH VB

Private Sub cmdConnect_Click()
  Dim x As Long
  x = WNetAddConnection("\\CPU1\C\WINDOWS\DESKTOP", "", "R:")
  If x <> 0 Then
    MsgBox "connect failed"
  End If
End Sub
Private Sub cmdDisconnect_Click()
  Dim x As Long
  x = WNetCancelConnection("R:", 0)
  If x <> 0 Then
    MsgBox "Disconnect failed"
  End If
End Sub

Download this snippet    Add to My Saved Code

MAP NETWORK DRIVE WITH VB Comments

No comments have been posted about MAP NETWORK DRIVE WITH VB. Why not be the first to post a comment about MAP NETWORK DRIVE WITH VB.

Post your comment

Subject:
Message:
0/1000 characters