Question:

How do i retrieve the Windows user id in VB6 so I can log the user's updates in my database? ?

by Guest60837  |  earlier

0 LIKES UnLike

there must be some keyword or reserved word that stores it but I am very new to VB.

Thanks.

 Tags:

   Report

1 ANSWERS




  1. Option Explicit

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

    Public Function GetNTUser() As String

    Dim strUserName As String

        strUserName = String(100, Chr$(0))

        GetUserName strUserName, 100

        GetNTUser = Left$(strUserName, InStr(strUserName, Chr$(0)) - 1)

    End Function

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.