Board index » delphi » Windows login

Windows login

Howdy all

I need to get the login name of the person logged in (Windows NT).
The windows login name.  

Much thanks.

Kris

 

Re:Windows login


Use GetUserName.

Herbert

--

---
Herbert Urwer
hur...@usd.de
http://www.usd.de

"The road goes ever on and on ..." (Bilbo Baggins)

Kris Bowyer schrieb in Nachricht <35060641.7...@zip.com.au>...

Quote
>Howdy all

>I need to get the login name of the person logged in (Windows NT).
>The windows login name.

>Much thanks.

>Kris

Re:Windows login


Hello Kris,

        Here is some code that works....Enjoy.

Bradley

{-------------------------------------------------------------------------}
{ Function GetUserID                                                      }
{   This function gets the user id from the NT LAN                        }
{-------------------------------------------------------------------------}
Function TLDLogon.GetUserID: Boolean;
var
    UserName    : array[0..255] of char;
    dwSize      : DWORD;
Begin
    FillChar(UserName, sizeof(userName), #00);
    dwSize := 255-1;
    If GetUserName(UserName, dwSize) Then Begin
      FUserID := UserName;
      Result  := True;
    End Else Begin
      FUserID := 'Unknown';
      Result  := False;
    End;
End;

Quote
> I need to get the login name of the person logged in (Windows NT).
> The windows login name.  

Other Threads