Autor Beitrag
uli
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41



BeitragVerfasst: Mi 22.10.03 13:09 
Wie kann ich den Usernamen des im Windows angemeldeten Users ermitteln?

Gruß Uli
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mi 22.10.03 13:23 
Hallo,

mit der Win-API-Funktion GetUserName.

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
CodeWicht
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 90

Win98, WinXP
D6
BeitragVerfasst: Mi 22.10.03 13:43 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
  function GetUser: String
  var 
    Buffer: Array[0..MAX_COMPUTERNAME_LENGTH +1of Char; 
    Size: DWord; 
  begin 
    Size := Pred(SizeOf(Buffer)); 
    Windows.GetUserName(Buffer, Size); 
    Result := StrPas(Buffer); 
  end;

_________________
The equal is true.