You often want to get the user ID of the current user on the machine running Windows 95 or Windows NT.Use this simple wrapper function of an API function to do the job:
Option ExplicitPrivate Declare Function WNetGetUserA _ Lib "mpr" (ByVal lpName As String, _ ByVal lpUserName As String, _ lpnLength As Long) As LongFunction GetUser() As String Dim sUserNameBuff As String * 255 sUserNameBuff = Space(255) Call WNetGetUserA(vbNullString, _ sUserNameBuff, 255&) GetUser = Left$(sUserNameBuff, _ InStr(sUserNameBuff, _ vbNullChar) - 1)End Function