'************************************** 'Windows API/Global Declarations for :95 ' /NT username '************************************** Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long '************************************** ' Name: 95/NT username ' Description:95/NT username "Joseph P. Fisher" <jfisher@cellone.net> ' By: Newsgroup Posting (from psc cd) ' ' ' Inputs:None ' ' Returns:None ' 'Assumes:None ' 'Side Effects:None '************************************** 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