When opening a file, there s no password setting. However, when mapping a drive you can do:
Map:
UnMap:VB Code:
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() WNetAddConnection "\\vdk00005\proj", "", "H:" End Sub
VB Code:
Private Declare Function WNetCancelConnection Lib "mpr.dll" Alias "WNetCancelConnectionA" (ByVal lpszName As String, ByVal bForce As Long) As Long Private DisconnectIt As Long 'Where H: is the drive letter you wish to dis-connect 'The second parameter of this API determines whether to disconnect ‘ the drive if there are files open on it. ‘ If it is passed FALSE, the disconnect will fail if there are open files 'If it is passed TRUE, the disconnect will occur no matter ‘ what is open on the drive DisconnectIt = WNetCancelConnection("H:", True)




Reply With Quote