+ -
当前位置:首页 → 问答吧 → 用getcomputername获得计算机名得到不同的结果,求解!

用getcomputername获得计算机名得到不同的结果,求解!

时间:2011-08-14

来源:互联网

为什么我会得到不同的结果呢?

作者: a63518839   发布时间: 2011-08-14

VB code
'看不到楼主的图片,可以这样试试:

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

Public Function computerName() As String

    Dim tmpstr As String
    Dim l As Long
    tmpstr = String(256, 0)
    l = GetComputerName(tmpstr, 256)
    computerName = Left$(tmpstr, InStr(tmpstr, Chr(0)) - 1)
    cClientName = computerName
 End Function

作者: Leftie   发布时间: 2011-08-14

热门下载

更多