We use a 'logon' nvo which has the following local external function:
Function boolean GetUserNameA (ref string name, ref ulong len) library "ADVAPI32.DLL"
This function retrieves the username.
//user win32 getusername
string ls_temp
ulong lul_value
boolean lb_rc
lul_value = 255
ls_temp = space(255)
lb_rc = GetUserNameA(ls_temp, lul_value)
If lb_rc Then
as_name = ls_temp
Return 1
Else
Return -1
End If