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

获得用户网络登录名

 

 

Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

 

Public Function NTDomainUserName() As String

Dim strBuffer As String * 255

Dim lngBufferLength As Long

Dim lngRet As Long

Dim strTemp As String

 

lngBufferLength = 255

lngRet = GetUserName(strBuffer, lngBufferLength)

strTemp = UCase(Trim$(strBuffer))

NTDomainUserName = Left$(strTemp, Len(strTemp) - 1)

 

End Function

 

补充:软件开发 , Vb ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,