用户在“卸载Msgbox”上单击“否”时如何打开网站?

时间:2019-01-01 04:06:29

标签: inno-setup

有办法吗?

enter image description here

点击“否”按钮,网站将使用默认浏览器打开吗?

谢谢!

2 个答案:

答案 0 :(得分:0)

无法将网站的启动限制为仅“否”按钮。您可以使用DeinitializeUninstall过程在卸载关闭时执行操作(单击“是”和“否”都会发生)。

下面是在几个不同地方启动网站的示例:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{15B3741D-9217-4F84-971A-9F5DD837B50B}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[code]
function InitializeUninstall(): Boolean;
var
 ErrCode : integer;
begin
   //This will launch the website before the "Do you want to remove..." dialog 
   ShellExec('open', 'http://google.com/', '', '', SW_SHOW, ewNoWait, ErrCode);
   result := true;
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
 ErrCode : integer;
begin
  //This will launch the website after "yes" is clicked in the "Do you want to remove..." dialog.
  ShellExec('open', 'http://google.com/', '', '', SW_SHOW, ewNoWait, ErrCode);
end;

答案 1 :(得分:0)

没有直接的API可以检测到用户单击了“否”

但是知道该卸载程序:

因此,如果从未调用DeinitializeUninstall的情况下调用CurUninstallStepChanged,则您知道用户单击了“否”

[Code]

var
  UninstallationStarted: Boolean;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  UninstallationStarted := True;
end;

procedure DeinitializeUninstall();
var
  ErrorCode: Integer;
begin
  if not UninstallationStarted then
  begin
    Log('User clicked No');
    ShellExec('open', 'https://www.example.com/uninstallationaborted', '', '',
              SW_SHOW, ewNoWait, ErrorCode);
  end;
end;