当前位置:编程学习 > VB >>

取得计算机名

答案:

声明:
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程序

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,