‘Task: How to get user server name [Computer name] when he login on network.
‘Declarations
Private Declare Function GetComputerName Lib “kernel32″ Alias “GetComputerNameA” (ByVal lpBuffer As String, nSize As Long) As Long
‘Code:
Private Sub Form_Load()
Dim dl,cnt As Long
Dim s As String
cnt = 200
s = Space$(cnt)
dl = Len(s)
Call GetComputerName(s, dl)
Text1.Text = Left$(s, dl)
End Sub