How can I read the username from windows NT server?

How can I read the username from windows NT server?

Post by Peter van der lind » Sun, 02 May 1999 04:00:00



Hi
Within the next few weeks, I will be changing my network over to
Windows NT from Novell. I have been using the CNovell utility in my
multiuser 2.6 application. What is the simplest way of obtaining the
user name (ie logon name) from a Windows NT server.
Thanks
Peter van der Linden
 
 
 

How can I read the username from windows NT server?

Post by Jan VAN DEN BOSC » Mon, 03 May 1999 04:00:00


Peter
probeer eens SYS(0)
Jan

Peter van der linden heeft geschreven in bericht

t>...

Quote:>Hi
>Within the next few weeks, I will be changing my network over to
>Windows NT from Novell. I have been using the CNovell utility in my
>multiuser 2.6 application. What is the simplest way of obtaining the
>user name (ie logon name) from a Windows NT server.
>Thanks
>Peter van der Linden


 
 
 

How can I read the username from windows NT server?

Post by Wayn » Mon, 03 May 1999 04:00:00


Also, NT has an environment variable called USERNAME, which can be
retrieved with
n = GETENV('USERNAME')
in Novell, the equivalent is n = GETENV('LOGIN_NAME')
HTH
wayne


> Peter
> probeer eens SYS(0)
> Jan

> Peter van der linden heeft geschreven in bericht

> t>...
> >Hi
> >Within the next few weeks, I will be changing my network over to
> >Windows NT from Novell. I have been using the CNovell utility in my
> >multiuser 2.6 application. What is the simplest way of obtaining the
> >user name (ie logon name) from a Windows NT server.
> >Thanks
> >Peter van der Linden

 
 
 

How can I read the username from windows NT server?

Post by Peter van der lind » Mon, 03 May 1999 04:00:00


To all who replied - thanks for the response.
Regards
Peter van der Linden
 
 
 

How can I read the username from windows NT server?

Post by Olav Bj?rn Lyg » Tue, 04 May 1999 04:00:00



Quote:>Hi
>Within the next few weeks, I will be changing my network over to
>Windows NT from Novell. I have been using the CNovell utility in my
>multiuser 2.6 application. What is the simplest way of obtaining the
>user name (ie logon name) from a Windows NT server.
>Thanks
>Peter van der Linden

Sys(0) returns machine name and user name.
Username returs a enviroment variable. (can be changed by anybody)

A Windows 95/Windows NT solution is to use the WIN32API
(the function GetUserName is the the WINNT / WIN32S DLLs):

? UserName()            && Returns username in a Windows 95/ Windows NT system

function UserName

cName=space(20)
length=20

  return left(cName,len(alltrim(cName))-1)
else
  return ""
endif

Olav Bj?rn Lygre