|
-
August 21st, 2001, 07:54 AM
#1
List of all the computers on the LAN
Can someone give me the code to dynamically generate a list of the names of all the computers on the LAN from either the server or any of the workstations.
Thanks in advance for any reply.
-
August 21st, 2001, 09:40 AM
#2
Re: List of all the computers on the LAN
Private Declare Function NetWkstaGetInfo Lib "netapi32" _
(ByVal servername As Long, _
ByVal level As Long, _
bufptr As Long) As Long
NetWkstaGetInfo returns information about the configuration of a workstation. The WKSTA_INFO_10? structure user returns information about a workstation environment, including platform-specific information, the name of the domain (or workgroup) and the local computer, as well as information concerning the operating system on the machines.
-
August 21st, 2001, 09:58 AM
#3
Re: List of all the computers on the LAN
hi,, i send u this code... i used into combo...
see u
Private Sub cboserver_GotFocus()
Dim pszTemp As String, pszServer As String, pszDomain As String
Dim nLevel As Long, i As Long, BufPtr As Long, TempBufPtr As Long
Dim nPrefMaxLen As Long, nEntriesRead As Long, nTotalEntries As Long
Dim nServerType As Long, nResumeHandle As Long, nRes As Long
Dim ServerInfo As SERVER_INFO_101
' Definiciones de los parámetros
nLevel = 101
BufPtr = 0
nPrefMaxLen = &HFFFFFFFF
nEntriesRead = 0
nTotalEntries = 0
nServerType = SV_TYPE_SQLSERVER ' Se define que tipo de servidores se desea cargar
nResumeHandle = 0
Do
nRes = NetServerEnum(pszServer, nLevel, BufPtr, _
nPrefMaxLen, nEntriesRead, nTotalEntries, _
nServerType, pszDomain, nResumeHandle)
If ((nRes = ERROR_SUCCESS) Or (nRes = ERROR_MORE_DATA)) And _
(nEntriesRead > 0) Then
TempBufPtr = BufPtr
For i = 1 To nEntriesRead
RtlMoveMemory ServerInfo, TempBufPtr, SIZE_SI_101
Debug.Print PointerToString(ServerInfo.lpszServerName)
TempBufPtr = TempBufPtr + SIZE_SI_101
Next i
Else
MsgBox "NetServerEnum failed: " & nRes
End If
NetApiBufferFree (BufPtr)
Loop While nEntriesRead < nTotalEntries
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|