During my install, I run a bat file. If the bat file returns an error, I need to abort/terminate the setup. I\'d like for it to do a MsgBox telling the user wha
Thank you, Robert. It is a common problem happening any time when script detects that setup cannot be continued.
However, there is a problem in your solution. WizardForm.Close invokes cancel dialog, and installation is stopped only if user answers "Yes". To exit definitely, we should invoke CancelButtonClick.
[Files]
Source: "MYPROG.EXE"; DestDir: "{app}"; AfterInstall: MyAfterInstall
[Code]
var CancelWithoutPrompt: boolean;
function InitializeSetup(): Boolean;
begin
CancelWithoutPrompt := false;
result := true;
end;
procedure MyAfterInstall();
begin
{ Do something }
if BadResult then begin
MsgBox('Should cancel because...',mbError,MB_OK)
CancelWithoutPrompt := true;
WizardForm.Close;
end;
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
if CurPageID=wpInstalling then
Confirm := not CancelWithoutPrompt;
end;