Das Notes Forum
Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: typeOneg am 13.11.06 - 12:35:25
-
hi,
gibt's eine Möglichkeit den Anmeldenamen des aktuellen benutzers auszulesen und in ein Feld zu schreiben?
thx
hans
-
Wie wäre es mit
Environ$("Username")
Das hilft mindestens in der Win32-Welt.
Gruß
Norbert
-
Geht auch per API, Quelle weiß ich nicht mehr :-\
This simple windows API call will retrieve the user name of the person currently looged on to the computer, be it the network user name, or the
Windows customisation user name. Just try it and see, it will come in pretty handy at times, if you want that extra bit of validation, or just want to make
sure who the person is via there windows user name.
Place the following API call into the declrations part of your database:
'-------------------------------------
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (Byval lpBuffer As String, nSize As Long) As Long
'-------------------------------------
This next part can go pertty much anywhere:
'-------------------------------------
Dim lpBuff As String * 25
Dim ret As Long
ret = GetUserName(lpBuff, 25)
UserName = Ucase(Left(lpBuff, Instr(lpBuff, Chr(0)) - 1))
Msgbox "User name: " + UserName
'-------------------------------------
-
Oder per @Formel
winuserid := @RegQueryValue("HKEY_LOCAL_MASCHINE"; "Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"; "DefaultUserName" );
@SetField("Benutzer"; winuserid)
-
danke euch für die prompten antworten. klappt jetzt einwandfrei (hab' auf die schnelle die Registry-Variante ausprobiert).
thx und schöne grüße aus salzburg.
hans