|
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function ComputerName()
Dim a As String * 40
Dim nSize As Long
nSize = 40
Call GetComputerName(a, nSize)
ComputerName = StrZ(a)
End Function
Private Function StrZ(par As String) As String
Dim nSize As Long, i As Long, Rez As String
nSize = Len(par)
i = InStr(1, par, Chr(0)) - 1
If i > nSize Then i = nSize
If i < 0 Then i = nSize
StrZ = Mid(par, 1, i)
End Function
Private Sub Form_Load()
MsgBox ComputerName()
End Sub
|
|