Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Mapping network share as a mapped drive using API

Total Hit ( 3784)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
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 MapDrive(share_name As String, Optional drive_letter As String = "G", Optional Password As String = "")
  Me.Caption = "Working..."
  Screen.MousePointer = vbHourglass
  DoEvents
  
  If InStr(drive_letter, ":") = 0 Then
    drive_letter = drive_letter & ":"
  End If
  
  If WNetAddConnection(share_name, Password, drive_letter) > 0 Then
    MsgBox "Error mapping drive"
  Else
    MsgBox "Drive mapped"
  End If
  Screen.MousePointer = vbDefault
End Sub

Private Sub Form_Load()
  Call MapDrive("\\it100626\API", "G") '//Map \\it100626\API as G: drive
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.