Use the GetUserName function:

var
  ComputerName: array[1..20] of Char;
  UserName: array[1..512] of Char;
  arrSize: dWord;
begin
  arrSize := SizeOf(ComputerName);
  GetComputerName(@ComputerName, arrSize);

  arrSize := SizeOf(UserName);
  GetUserName(@UserName, arrSize);

  ShowMessage('Computer name is: ' + ComputerName +
#13#10 + 'User name is: ' + UserName)
end;

With best regards, Mike Shkolnik
EMail: [EMAIL PROTECTED]
http://www.scalabium.com

--- [EMAIL PROTECTED] wrote:

> Hi Group
>
> How can I know the name of the user currently logged
> in? Note that it
> might be a local user or a user created on a
> domain... I searched in the
> registry but could not find the right key.
>
> Thank you in advance
>
> Vahan Yoghoudjian
> Schneider Electric
> East Mediterranean s.a.l


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]




SPONSORED LINKS
C programming language Computer programming languages Java programming language
The c programming language C programming language Concept of programming language


YAHOO! GROUPS LINKS




Reply via email to