There's an API for this as well - GetUserName, I think.