如何取得计算机名
来源:岁月联盟
时间:2007-02-01
Form1
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Command1_Click()
Dim Name As String, Length As Long
Length = 225
Name = String(Length, Chr(0))
GetComputerName Name, Length
Name = Left(Name, Length)
Label1.Caption = Name
End Sub
Private Sub Form_Load()
End Sub
下一篇:用API函数控制光驱的开关