Howdy,
I'm getting different values from the ERR function, depending on how it's used. For example:
FILECOPY file1, file2
sets ERR to 183 if 'file2' exists (listed in WINAPI.INC as "File exists"). If I try and test for it, it fails:
FILECOPY file1, file 2
IF ERR = 183 THEN
...Alert the user...
END IF
But the IF statement evaluates FALSE. Huh??? Even in the debugger the ERR value is 183.
However, if I assign ERR to a variable and try again, it turns out that ERR is also reporting 75! Like so:
LOCAL lErrorCode AS LONG, lApiError as LONG
FILECOPY file1, file 2
lErrorCode = ERR
lApiError = ERRAPI
IF lErrorCode = 75 THEN
...Alert the user...
END IF
Now the 'lErrorCode' variable is 75 and the 'lApiError' variable is 183, as they should be, so the IF statement evaluates TRUE and everything is correct. I don't understand; shouldn't the ERR and ERRAPI functions return the correct values without having to assign them to a variable?
Thanks,
-------------
---
Mark Newman
I'm getting different values from the ERR function, depending on how it's used. For example:
FILECOPY file1, file2
sets ERR to 183 if 'file2' exists (listed in WINAPI.INC as "File exists"). If I try and test for it, it fails:
FILECOPY file1, file 2
IF ERR = 183 THEN
...Alert the user...
END IF
But the IF statement evaluates FALSE. Huh??? Even in the debugger the ERR value is 183.
However, if I assign ERR to a variable and try again, it turns out that ERR is also reporting 75! Like so:
LOCAL lErrorCode AS LONG, lApiError as LONG
FILECOPY file1, file 2
lErrorCode = ERR
lApiError = ERRAPI
IF lErrorCode = 75 THEN
...Alert the user...
END IF
Now the 'lErrorCode' variable is 75 and the 'lApiError' variable is 183, as they should be, so the IF statement evaluates TRUE and everything is correct. I don't understand; shouldn't the ERR and ERRAPI functions return the correct values without having to assign them to a variable?
Thanks,
-------------
---
Mark Newman
Comment