欢迎来到Java学习网!
设为首页 | 加入收藏
当前位置: 首页 > 编程开发 > VB语言 >

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

Public Function GetPcName() As String
Dim compname As String, retval As Long
compname = Space(255)
retval = GetComputerName(compname, 255)
compname = Left(compname, InStr(compname, vbNullChar) - 1)
GetPcName = compname
End Function

 

    相关教程
    推荐内容