Mapear uma unidade de rede;
Declare Function WNetAddConnection Lib “mpr.dll” Alias “WNetAddConnectionA”
(ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName _
As String) As Long
Declare Function WNetGetConnection Lib “mpr.dll” Alias “WNetGetConnectionA”
_
(ByVal lpszLocalName As String, ByVal lpszRemoteName As String, cbRemoteName _
As Long) As Long
Declare Function WNetCancelConnection Lib “mpr.dll” Alias “WNetCancelConnectionA” _
(ByVal lpszName As String, ByVal bForce As Long) As Long
Dim Caminho As String, Unidade as String
Caminho = “\\Computador\Caminho”
Unidade = “I:”
‘Realiza conexão
WNetAddConnection Caminho , “Se tiver senha, digite á aqui”,
unidade
‘Consulta caminho de uma determinada conexão, _
‘neste caso, na variável caminho será armazenado o local do caminho
_
‘atual ref. a unidade
WNetGetConnection Unidade, Caminho, 255)
‘Desconecta
WNetCancelConnection Unidade, True