# 用API

Posted by 帅帅阿柳 on October 30, 1998 at 16:10:23:

In Reply to: 如何得知目前有Login的UserName? posted by Someone on October 26, 1998 at 09:16:17:

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

Function GetUser() As String

Dim lpUserID As String
Dim nBuffer As Long
Dim Ret As Long
lpUserID = String(25, 0)
nBuffer = 25
Ret = GetUserName(lpUserID, nBuffer)

If Ret Then
GetUser$ = lpUserID$
End If

End Function

Function ClipNull(InString As String) As String

Dim intpos As Integer

If Len(InString) Then
intpos = InStr(InString, vbNullChar)
If intpos > 0 Then
ClipNull = Left(InString, intpos - 1)
Else
ClipNull = InString
End If
End If

End Function

Follow Ups:

- 连上LAN的人 Someone 15:37:37 10/31/98 (0)