tags:

views:

19

answers:

2

Hello,

is it possible to start a Inno Setup, that waits until the child process has finished? The current systems default behaviour is that the setup starts the "real" setup in temporary folder and goes further in command line. My aim is that the parent process should wait until the child finishes to read out the return code in errorlevel variable. I've made a picture for better understanding

My 2nd question is how Inno handles the setup exit codes. Where can they read out after setup has finished? If an error occurs in setup or user clicks cancel the env-variable %errorlevel% is always 0.

Thanks in advance

A: 

The following code sample calls child.exe during the post-install step:

procedure CurStepChanged(CurStep: TSetupStep);
var
  ErrorCode: integer;
begin
  if (CurStep = ssPostInstall) then
  begin
    WizardForm.Hide;
    ShellExec('open', 'child.exe', '', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
    WizardForm.Show;
    if (ErrorCode <> 0) then
    begin
      // error handling
    end;
  end;
end;
splash
Sorry, but that is not what I mean. It is not my own child process, but the Inno-child process. [See this picture of process explorer](http://img525.imageshack.us/img525/516/inno2.gif)
A: 

What you are trying to do is a function of the OS, not really InnoSetup. Use the following to do what you want from a command prompt or batch file:

start /wait setup.exe
echo %ERRORLEVEL%
mirtheil