How to set the error level at the output of the MFC application

I have an outdated MFC application that I support. I'm not quite sure how to determine the version of MFC, and I don’t think it will make a difference.

An application may accept some parameters on the command line; I would like to be able to set the error level when exiting the application so that the bat / cmd file checks for a failure and responds accordingly.

I do not believe that exit () will work (I have not tried it honestly yet) due to the fact that this is an MFC application. Does anyone know how to set the error level returned by the MFC application? Is it possible to use exit ()?

+3
source share
4 answers

, , , .

CWinApp:: ExitInstance(); return myExitCode;

, .

+5

ERRORLEVEL DOS, , , "start/wait", , .

+2

, , , , .

+1

CWinApp:: ExitInstance. -, quit. , AfxPostQuitMessage, . .

+1
source

Source: https://habr.com/ru/post/1699219/


All Articles