Public Declare Function GetComputerNameA Lib "Kernel32" (ByVal lpBuffer As String, ByRef nSize As Long) As Long
' Возвращает имя компьютера в сети
Function GetComputerName() As String
Const MAX_COMUTERNAME = 99
Dim lpBuffer As String * MAX_COMUTERNAME
Dim lenString As Long
On Error GoTo GetComputerName_Error
Call SysCmd(acSysCmdSetStatus, "Osnovnoy -> " & "GetComputerName")
lenString = MAX_COMUTERNAME
Call GetComputerNameA(lpBuffer, lenString)
'GetComputerName = Left$(lpBuffer, lenString)
GetComputerName = StrConv(Left$(lpBuffer, lenString), vbLowerCase)
On Error GoTo 0
Exit Function
GetComputerName_Error:
End Function
|