Ecco un esempio:
codice:Private Declare Auto Function WNetGetConnection Lib "mpr.dll" (ByVal lpLocalName As String, ByVal lpRemoteName As Text.StringBuilder, ByRef lpnLength As Integer) As Integer '... Dim retCode As Integer Dim buffer As New Text.StringBuilder(255) retCode = WNetGetConnection("z:", buffer, buffer.Capacity) If Not retCode Then Console.WriteLine(buffer.ToString()) Else Console.Write("Errore ") Console.Write(retCode) Console.WriteLine(".") End If