Page 1 of 1

DOS errorlevel codes

Posted: Wed Jul 06, 2005 9:16 pm
by markar
When I run ExamDiff (1.6k) from a batch script, I see a positive errorvalue left in the environment after ExamDiff exits. For most DOS programs this indicates that the program quit with an error. But ExamDiff seems to be running fine. I've seen error codes of 3, 20, and 27.

I cannot find any list anywhere of error codes that might be returned by ExamDiff. Maybe these values are an indicator of how I quit the program (usually using the Esc key), or the number of differences or something.

It's not crucial, but I am curious. Overall, the program is working great and I'm very happy with it.

Mark

Posted: Thu Jul 07, 2005 4:18 pm
by psguru
ExamDiff is an MFC program. When an MFC application exits, and it does not specifically care about exit codes (the case with ExamDiff, which was not designed for console use), MFC uses the last Windows message's wParam as the exit code. I couldn't find code 3 but here's the list of different exit codes based on how the program was terminated:

- Close button: 20 (last message = WM_NCLBUTTONDOWN, wParam = HTCLOSE = 20)
- Esc key: 27 (last message = WM_KEYDOWN, wParam = VK_ESCAPE = 27)
- Close command in the system menu: 61536 (last message = WM_SYSCOMMAND, wParam = SC_CLOSE = 61536)
- Exit toolbar button: 0 (last message = WM_LBUTTONUP, wParam = 0)
- File | Exit menu command: 1013 (last message = WM_COMMAND, wParam = 1013)

Posted: Thu Jul 07, 2005 6:21 pm
by markar
Thanks, I suspected something of the sort. My batch scripts could have used a value telling me the number of diffs, or somesuch, but it is nothing important. For now, I'll just ignore the return values.

Since I use ExamDiff to compare my current test output to approved test output, there is an interesting possibility of a script that determines how to handle a difference based on how I exit ExamDiff. Ideally, I'd love to have a big "Accept" button that would close ExamDiff with an identifiable code that my scripts could use.

Thanks again,

Mark

Posted: Thu Jul 07, 2005 6:28 pm
by psguru
If it's any consolation, ExamDiff Pro exit codes are as follows:

0 - no differences found
1 - differences found
2,3,4 - error occurred (3 different kinds of errors are possible)