Name of the logged-on user(sys.LoggedOnUser)ΒΆ

sys.LoggedOnUser,,a0,,v

Name of the logged-on user

This variable is initialised to the name of the logged-on user the first time its value is read. The name is available on Windows and UNIX, and is obtained from an operating system call, not from the environment variable LOGNAME. This makes sys.LoggedOnUser more secure than sys.UserName.

The value is not initialised automatically when the program starts, because the system call is very slow on some UNIX systems.

The actual length of sys.LoggedOnUser is set to the length of the text string it references. Since the length is not known until it has been read for the first time, a textbox that is linked to this field must be created after retrieving the value. The example below demonstrates this.

EXAMPLE

!temp Dummy,,a1                   /* The field size of this temp is not important */

     +textbox LoggedOnUserBox at 102,15 {
          field = sys.LoggedOnUser
          label = "User logon name"
     }

     tmp.Dummy = sys.LoggedOnUser
     create LoggedOnUserBox
     display LoggedOnUserBox

RELATED TOPICS

sys.UserName