怎么获取计算机名字?
怎么获取计算机名字?谢谢了。
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function GetComputer() As String
Dim strCompName As String
Dim intHandle As Integer
strCompName = String(256, " ")
intHandle = GetComputerName(strCompName, 256)
strCompName = Left(strCompName, InStr(1, strCompName, Chr(0)) - 1)
GetComputer = Trim(strCompName)
End Function