I have followed this link to assign custom exitcode for the installer (.exe file)
I did this :
Method 1 :
[Code]
procedure ExitProcess(exitCode:integer);
external 'ExitProcess@kernel32.dll stdcall';
var1 : = 10
if (var1 <> 12) then //not equal to 12
begin
msgBox(<some message,mbInformation,MB_OK)
ExitProcess(9)
end;
I have DOS shell script like this :
@echo off
my_exe.exe /verysilent
if %errorlevel% == 9 (
echo Failure reason given is %errorlevel%
exit /b %errorlevel%
)
The output is : Failure reason given is 9
Method 2 :
Now I used the following code :
function GetCustomSetupExitCode: Integer;
begin
result := 9
end;
var1 : = 10
if (var1 <> 12) then //not equal to 12
begin
msgBox(<some message,mbInformation,MB_OK)
// ExitProcess(9)
GetCustomSetupExitCode();
end;
I used the same DOS script In the output now I cant get the any exit code printed in the DOS.
Which way is correct.Is it safe to use ExitProcess()