Inno setup 选择数据库路径或让安装继续

Inno setup 选择数据库路径或让安装继续,inno-setup,Inno Setup,我试图在InnoSetup中做一些事情,但我做不到。我想让用户选择是安装数据库还是为此数据库选择路径 更具体地说,我将有一个包含两个组件的页面: “标准”和“服务器” 案例1: 如果用户选择“标准”,安装将正常继续,并在本地安装数据库 案例2: 如果用户选择了“服务器”,下一页将用于选择基本路径(例如网络共享),并且不要在本地安装数据库 我从Inno设置开始(特别是对于代码部分),我如何才能做到这一点 以下是我当前代码的一个示例,请注意,我已尝试将互联网上找到的代码改编为我的问题,但这并不一定合

我试图在InnoSetup中做一些事情,但我做不到。我想让用户选择是安装数据库还是为此数据库选择路径

更具体地说,我将有一个包含两个组件的页面: “标准”和“服务器”

案例1: 如果用户选择“标准”,安装将正常继续,并在本地安装数据库

案例2: 如果用户选择了“服务器”,下一页将用于选择基本路径(例如网络共享),并且不要在本地安装数据库

我从Inno设置开始(特别是对于代码部分),我如何才能做到这一点

以下是我当前代码的一个示例,请注意,我已尝试将互联网上找到的代码改编为我的问题,但这并不一定合适:

[Types]
Name: "standard"; Description: "Local Database";
Name: "server"; Description: "Server Database"; Flags: iscustom

[Components]
Name: "baselocal"; Description: "Standard Installation : install program and local database"; Types: standard; 
Name: "baseserver"; Description: "Installation with server database : install program and choose directory for database"; Types: server;

[Files]
Source: "Path\to\database\*"; DestDir: "{app}\{code:GetDir|0}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: standard

[Code]
// Database choice
var
  DirPage: TInputDirWizardPage;
  DirPageID: Integer;

function GetDir(Param: String): String;
begin
  Result := DirPage.Values[StrToInt(Param)];
end;

procedure InitializeWizard;
begin
  // create a directory input page
  DirPage := CreateInputDirPage(wpSelectComponents, 'Choix de la base', 'Caneco BT peut gérer une base sur un serveur ou en local. Veuillez indiquez le chemin de la base qui vous intéresse.', 'Dossier Base de Données', False, '');
  // add directory input page items
  DirPage.Add('Sélectionnez un chemin :');
  // assign default directories for the items from the previously stored data; if
  // there are no data stored from the previous installation, use default folders
  // of your choice
  DirPage.Values[0] := GetPreviousData('Directory1', ExpandConstant('{pf}\program\'));
  DirPageID := DirPage.ID;
end;

procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
  // store chosen directories for the next run of the setup
  SetPreviousData(PreviousDataKey, 'Directory1', DirPage.Values[0]);
end;
// Skip page
function ShouldSkipPage(PageID: Integer): Boolean;
begin
  // initialize result to not skip any page (not necessary, but safer)
  Result := False;
  // if the page that is asked to be skipped is your custom page, then...
  if PageID = DirPageID then
    // if the component is not selected, skip the page
    Result := not IsComponentSelected('help');
end;

提前谢谢你

我开始归零,因此尝试这样做:

[code]
var
  ActionPage: TInputOptionWizardPage;
  DirPage: TInputDirWizardPage;
  DirPageID: Integer;

procedure InitializeWizard;
begin
  ActionPage := CreateInputOptionPage(wpWelcome,
    'Optional Actions Test', 'Which actions should be performed?',
    'Please select all optional actions you want to be performed, then click Next.',
    True, False);

  ActionPage.Add('Action 1');
  ActionPage.Add('Action 2');

  ActionPage.Values[0] := True;
  ActionPage.Values[1] := False;
end;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
  Result := True;
  if CurPageID = ActionPage.ID then begin
    if ActionPage.Values[0] then
                begin
                  // create a directory input page
                  DirPage := CreateInputDirPage(wpSelectComponents, 'Choix de la base', 'Caneco BT peut gérer une base sur un serveur ou en local. Veuillez indiquez le chemin de la base qui vous intéresse.', 'Dossier Base de Données', False, '');
                  // add directory input page items
                  DirPage.Add('Sélectionnez un chemin :');
                  // assign default directories for the items from the previously stored data; if
                  // there are no data stored from the previous installation, use default folders
                  // of your choice
                  DirPage.Values[0] := GetPreviousData('Directory1', ExpandConstant('{pf}\program\'));
                  DirPageID := DirPage.ID;
                  exit;
                end;

    if ActionPage.Values[1] then
       MsgBox('Local Database', mbInformation, MB_OK);
       exit;
  end;
end;
这是可行的(我为此感到非常高兴),但我有一个问题:

如果我选择“Action1”进入“DirPage”页面,然后返回,选择“Action2”,则会出现“DirPage”页面

否则,如果我从开始选择“Action2”,则页面“DirPage”不会按预期显示


为什么??我能解决这个问题吗?

用户界面呢?我想会的,我会试试这个(thx@TLama for save me second times^^)@TLama好的,但有几件事困扰着我:下一步按钮可能是灰色的,因为它没有被选中?我只能选择文件,然后我会选择一个文件夹并在注册表项中复制该文件夹的路径。我该怎么做?有些什么?是的,就是这样:)但当我选择“没有文件选择的选项”时,我无法继续:(