Hi All,
I have done much web searching (and searched these forums) but I can't seem to find the solution to this;
I am wanting to resolve the current signed on users Name. I have the code to work out their ID number, but I want their actual name from this.
Is this possible please? A friend has passed me the perl code equivelent and its only a few lines.
Here is my current VB code;
VB Code:
Private Declare Function GetUserNameAPI Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, _ nSize As Long) As Long Public Function GetUserName() As String Dim sBuffer As String Dim lSize As Long Dim lRV As Long lSize = 255 sBuffer = String(lSize, &H0) lRV = GetUserNameAPI(sBuffer, lSize) If lRV <> 0 Then GetUserName = Left(sBuffer, lSize - 1) ' -1 to remove trailing null character Else GetUserName = "" End If End Function Private Sub Command1_Click() MsgBox GetUserName End Sub
Any ideas?
Cheers!
Paul.




Reply With Quote