| You can obtain the users network login id for most popular network
clients with a call to the windows API call WNetGetUserName. This call works for Netware,
Windows for Workgroups, Windows NT, Windows 95 and LanManager. For 32 bit applications you
will need to make a different call to the API function GetUserNameA(). For
16-bit apps
//Declare an external function as:
function int WNetGetUser( ref string userid, ref uint len ) library "user.exe"
In PowerScript
string login_name
uint lui_len
int li_rc
string ls_temp
lui_len = 255
ls_temp = space( 255 )
li_rc = WNetGetUser( ls_temp, lui_len )
login_name = Trim( ls_temp )
For 32-bit apps
//Declare an external function as:
Function boolean GetUserNameA( ref string userID, ref ulong len ) library
"ADVAPI32.DLL"
In Powerscript
string login_name
string ls_temp
ulong lul_value
boolean lb_rc
lul_value = 255
ls_temp = Space( 255 )
lb_rc = GetUserNameA( ls_temp, lul_value )
login_name = Trim( ls_temp ) |