I am trying to create a MsgBox
with three buttons and three outcomes, but am unable to see how I can create the third outcome? I currently have the following code for a two button MsgBox
, which works perfectly:
if ((strExistingInstallPath <> '') and (strExistingVersion = '2.5.3')) then
begin
if SuppressibleMsgBox('Setup has detected that ' + strMyAppName + ' ' + strExistingVersion + '.' + strExistingBuild + ' is installed.' + #13#10 + #13#10 +
'The existing version must be removed before installing or upgrading to ' + strMyAppVersion + '.' + strMyAppBuild + '.' + #13#10 + #13#10 +
'Would you like Setup to uninstall the existing version?',
mbConfirmation, MB_YESNO, IDYES) = IDYES then
begin
Exec(GetUninstallString, '', '', SW_SHOW,
ewWaitUntilTerminated, intResultCode);
Result := True;
end else
begin
MsgBox('The existing version must be removed first.' + #13#10 +
'Setup is unable to continue. Setup will now exit.',
mbError, MB_OK);
Result := False;
end;
end;
If I change the MB_YESNO
to MB_YESNOCANCEL
, I now get three buttons, Yes, No and Cancel. However, since the if
statement is assigned to the MsgBox
, I'm struggling to work out how to do an else if IDCANCEL then
type statement. I tried to assign the ID constant returned by the MsgBox to a string and then create separate if statements for the string being equal to each ID constant, but this failed miserably. What am I missing here? Ideally, I would like the three buttons be labelled as Yes, No and Silent, so that the third button can be given a /silent
parameter to prevent the uninstall prompt. So, is it possible to rename the buttons as well?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…