Private Type WKSTA_INFO_102
wki100_platform_id As Long
pwki100_computername As Long
pwki100_langroup As Long
wki100_ver_major As Long
wki100_ver_minor As Long
pwki102_lanroot As Long
wki102_logged_on_users As Long
End Type
Private Declare Function NetWkstaGetInfo Lib "netapi32" (ByVal servername As String, ByVal level As Long, lpBuf As Any) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)
Sub Main()
Dim pWrkInfo As Long, WrkInfo(0) As WKSTA_INFO_102, lResult As Long
'имя твоего pc в сети
Const strComputername = "HACKER"
lResult = NetWkstaGetInfo(StrConv("\\" & strComputername, vbUnicode), 102, pWrkInfo)
If lResult = 0 Then
Dim cname As String
cname = String$(255, 0)
CopyMemory WrkInfo(0), ByVal pWrkInfo, ByVal Len(WrkInfo(0))
CopyMemory ByVal cname, ByVal WrkInfo(0).pwki100_langroup, ByVal 255
MsgBox StripTerminator(StrConv(cname, vbFromUnicode))
End If
End Sub
Private Function StripTerminator(sInput As String) As String
Dim ZeroPos As Integer
ZeroPos = InStr(1, sInput, vbNullChar)
If ZeroPos > 0 Then StripTerminator = Left$(sInput, ZeroPos - 1) Else StripTerminator = sInput
End Function
Private Sub Form_Load()
Main
End Sub
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 87