VB获取网上邻居里的计算机名上
Opti on Explicit
Private Const RESOURCE_CONNECTED As Long = &H1&
Private Co nst RESOURCE_GLOBALNET As Long = &H2&
Private Co nst RESOURCE_REMEMBERED As Long = &H3&
Private Co nst RESOURCEDISPLAYTYPE_DIRECTOR Y& = &H9
Private Con st RESOURCEDISPLAYTYPE_DOMAI N& = &H1
Private Const RESOURCEDISPLAYTYPE_FILE & = &H4
Private Const RESOURCEDISPLAYTYPE_GENERIC & = &H0
Private Const RESOURCEDISPLAYTYPE_GROUP & = &H5
Private Const RESOURCEDISPLAYTYPE_NETWORK & = &H6
Private Const RESOURCEDISPLAYTYPE_ROOT & = &H7
Private Const RESOURCEDISPLAYTYPE_SERVER & = &H2
Private Const RESOURCEDISPLAYTYPE_SHARE & = &H3
Private Co nst RESOURCEDISPLAYTYPE_SHAREADM IN& = &H8
Private Con st RESOURCETYPE_ANY As Long = &H0&
Private Const RESOURCETYPE_DISK As Long = &H1&
Private Const RESOURCETYPE_PRINT As Long = &H2&
Private Const RESOURCETYPE_UNKNOWN As Long = &HFFFF&
Private Con st RESOURCEUSAGE_ALL As Long = &H0&
Private Const RESOURCEUSAGE_CONNECTABLE As Long = &H1&
Private Co nst RESOURCEUSAGE_CONTAINER As Long = &H2&
Private Const RESOURCEUSAGE_RESERVED As Lo ng = & Private Con st NO_ERROR = 0
Private Const ERROR_MORE_DA TA = 234 'L // dderror
Private Const RESOURCE_ENUM_ALL As Long = &HFFFF
Private Type NETRESOURCE dwScope As Long dwType As Long dwDisplayType As Long dwUsage As Long pLocalName As Long pRemoteName As Long pComme nt As Long pProvider As Long
End Type
Private Type NETRESOURCE_REAL dwScope As Long dwType As Long dwDisplayType As Long dwUsage As Long sLocalName As Stri ng sRemoteName As Stri ng
sComme nt As String
sProvider As String
End Type
Private Declare Function WNetAddConnection2 Lib "mpr.dll" Alias "WNetAddConnection2A" (IpNetResource As NETRESOURCE, ByV al lpPassword As String, ByV al IpUserName As String, ByVal dwFlags As Long) As Long
Private Declare Function WNetOpenEnum Lib "mpr.dll" Alias "WNetOpenEnumA" (ByVal dwScope As Long, ByV al dwType As Long, ByV al dwUsage As Long, lpNetResource As Any, lphE num As Long) As Long
Private Decla