Declare Function GetUserName Lib \"advapi32.dll\" Alias \"GetUserNameA\" _ (ByVal lpBuffer As String, nSize As Long) As Long
Public Function gstrGetLoggedInUser() Dim sBuff As String * 25 Dim lRet As Long: Dim char_zero Dim sUserName As String: Dim GetLoggedInUser As String \'Get the user name, remove NULLs, and trim trailing spaces. lRet = GetUserName(sBuff, 25) sUserName = Trim$(Left(sBuff, InStr(sBuff, Chr(char_zero)) - 1)) \'Return empty if no name is returned. If sUserName = vbNullString Then GetLoggedInUser = \"\" gstrGetLoggedInUser = sUserName End Function
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.