vb获取 计算机ID

来源:百度知道 编辑:UC知道 时间:2024/09/20 07:26:04
text1=计算机标识号
text2=完整计算机名

可以用API

但是不能用控件

Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Dim Name As String, Length As Long
Length = 225
Name = String(Length, Chr(0))
GetComputerName Name, Length
Name = Left(Name, Length)
Label1.Caption = Name