Domino 9 und frühere Versionen > ND6: Entwicklung

Windows Account auslesen

(1/1)

typeOneg:
hi,

gibt's eine Möglichkeit den Anmeldenamen des aktuellen benutzers auszulesen und in ein Feld zu schreiben?

thx
hans

LN4ever:
Wie wäre es mit

Environ$("Username")

Das hilft mindestens in der Win32-Welt.

Gruß

Norbert

Driri:
Geht auch per API, Quelle weiß ich nicht mehr   :-\


--- Zitat ---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
'-------------------------------------

--- Ende Zitat ---

y20frank:
Oder per @Formel

winuserid := @RegQueryValue("HKEY_LOCAL_MASCHINE"; "Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"; "DefaultUserName" );
@SetField("Benutzer"; winuserid)

typeOneg:
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

Navigation

[0] Themen-Index

Zur normalen Ansicht wechseln