Das Notes Forum

Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: typeOneg am 13.11.06 - 12:35:25

Titel: Windows Account auslesen
Beitrag 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
Titel: Re: Windows Account auslesen
Beitrag von: LN4ever am 13.11.06 - 12:42:23
Wie wäre es mit

Environ$("Username")

Das hilft mindestens in der Win32-Welt.

Gruß

Norbert
Titel: Re: Windows Account auslesen
Beitrag von: Driri am 13.11.06 - 12:46:06
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
'-------------------------------------
Titel: Re: Windows Account auslesen
Beitrag von: y20frank am 13.11.06 - 14:43:00
Oder per @Formel

winuserid := @RegQueryValue("HKEY_LOCAL_MASCHINE"; "Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"; "DefaultUserName" );
@SetField("Benutzer"; winuserid)
Titel: Re: Windows Account auslesen
Beitrag von: typeOneg am 13.11.06 - 15:40:11
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