DECLARE INTEGER WNetGetUser IN Win32API STRING @, STRING @, INTEGER @ cUserName = SPACE(261) lres = WNetGetUser('U:', @cUserName, 261) IF lres = 0 .and. ( at("\", cUserName) > 0 ) * remove the "DOMAIN1/" Windows7 need to look for the / character * first remove the path preceding the username cUserName = substr(cUserName,at("\", cUserName)+1) Thisform.cusername = PADR(UPPER(left(cUserName,at(chr(0),cUserName) -1)),8) ELSE Thisform.cusername = "Visitor" ENDIF cname = thisform.cusername && cname is public in the main program and needed in pshutfdown to log offHTH