Hi,
You can use a couple of APIs to set a return code from your Progam:
The following statements go into the Declarations section:
Then, when you exit your Program;
Where lngReturn, lngprocess and lngReturncode are of type Long
You should set lngReturnCode to the value you wish to be passed back to the .bat file.
The Variable ERRORLEVEL within the .bat file will be set to the value of lngReturnCode when the program terminates.
Example .bat file:
This executes the program called MyProg.exe and if it sets the return code to 4 a message "Error 4" is displayed.
Regards
Doug