devxlogo

Getting UserID on Windows 95 and NT

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

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  How Seasoned Architects Evaluate New Tech

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.