nLastError = GetLastError()In your code the GetLastError is called concurrently with the TRANSFORM() and the MESSAGEBOX() calls. May happen that any of these already reset the last error state.
nToken = 0 = LogonUser(cUsr, cDomain, cPwd,; LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, @nToken) IF nToken = 0 * 1326 = ERROR_LOGON_FAILURE * 1327 = ERROR_NO_SUCH_MEMBER * 1385 = ERROR_LOGON_TYPE_NOT_GRANTED ? "Error:", GetLastError() RETURN .F. ENDIF