Board index » delphi » Find name of logged on user

Find name of logged on user

How can I find the name of a logged-on user, and which server he is logged
on to,  (Novell client running in Windows) using Delphi?
 

Re:Find name of logged on user


Quote
> How can I find the name of a logged-on user, and which server he is logged
> on to,  (Novell client running in Windows) using Delphi?

For the first you can use the following function.
For your second question I have no answer, too...

function theUserName:string;
var UserName:PChar;
    NameLength:dWord;
begin
     UserName:=StrAlloc(80);
     NameLength:=dWord(StrBufSize(UserName));
     if WNetGetUser('',UserName,Namelength)=NO_ERROR then
        Result:=StrPas(UserName)
     else
         Result:='Error: '+IntToStr(GetLastError);
     StrDispose(UserName);
end;

Hth,
Matthias.

Other Threads