答案:声明:
Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
例子:
Public Function MachineName() As String
Dim sBuffer As String * 255
If GetComputerName(sBuffer, 255&) <> 0 Then
MachineName = Left$(sBuffer, InStr(sBuffer, vbNullChar) - 1
Else
MachineName = "(未知)"
End If
End Function文章来自vb爱好者:http://vb.zzzyk.com
上一个:设置计算机名称
下一个:如何去优化你的VB程序