Advertisement
2002C Windows API Call/ Explanation #9163

Get the logged on username from Windows 95/98/NT

Get the logged on username from Windows 95/98 and NT

AI

KI-Zusammenfassung: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Quellcode
original-source
gsUserId = ClipNull(GetUser())
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
Originalkommentare (3)
Wiederhergestellt von der Wayback Machine