VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Connect to a remote share AUTOMATICALLY, with NO user input.

by Jon Barker (11 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (6 Votes)

Ive seen a lot of source code that can bring up the window asking the user to connect to a remote share, but none of which would work without user input. This API call (WNetAddConnection) is very easy and simple to use, altho i cant guarrentee it will work on 98/ME.... tHe_cLeanER

Rate Connect to a remote share AUTOMATICALLY, with NO user input.

Option Explicit
Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
Private Sub Form_Load()
Dim r As Long
r = WNetAddConnection("\\dedicated\xpserver", vbNullString, "x:")
If r <> 0 Then
 MsgBox "ERROR: " & Err.Description
End If
End Sub

Download this snippet    Add to My Saved Code

Connect to a remote share AUTOMATICALLY, with NO user input. Comments

No comments have been posted about Connect to a remote share AUTOMATICALLY, with NO user input.. Why not be the first to post a comment about Connect to a remote share AUTOMATICALLY, with NO user input..

Post your comment

Subject:
Message:
0/1000 characters