2016-03-30 33 views
0

すべてのコンポーネントがすでにインストールされているときにセットアップを停止しようとしています。すべてのコンポーネントがInno Setupにインストールされている場合のセットアップの終了

インストール例:

  1. まずインストール:1つのコンポーネントをインストール
  2. セカンドインストール:コンポーネントの残りの部分をインストール
  3. サードインストール:セットアップを開始するとwpFinishedページに直接移動または停止し、メッセージを入れます「すべてのコンポーネントは既にインストールされている」と言っています。

    procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean); 
    begin 
        Confirm := False; 
    end; 
    
    procedure InitializeWizard; 
    var 
        ItemIndex: Integer; 
        InstallEn: String; 
        InstallFr: String; 
        InstallDe: String; 
        CompDescEnIndex: Integer; 
        CompDescFrIndex: Integer; 
        CompDescDeIndex: Integer; 
        Check: Integer; 
    begin 
        # This part is to make not selectable component already install 
        if RegQueryStringValue(HKLM, 'Software\COMPANY\{#RegProduct}\{#RegCurVer}', 'Install-ENG', InstallEn) then 
         if ((InstallEn = 'International Pack') 
         or (InstallEn = 'Pack International') 
         or (InstallEn = 'International Paket')) 
          then 
           ItemIndex := WizardForm.ComponentsList.Items.IndexOf(CustomMessage('CompDescEn')); 
           WizardForm.ComponentsList.ItemEnabled[ItemIndex] := False; 
        if RegQueryStringValue(HKLM, 'Software\COMPANY\{#RegProduct}\{#RegCurVer}', 'Install-FRA', InstallFr) then 
         if ((InstallFr = 'French Pack') 
         or (InstallFr = 'Pack France') 
         or (InstallFr = 'Franzosisch Paket')) 
          then 
           ItemIndex := WizardForm.ComponentsList.Items.IndexOf(CustomMessage('CompDescFr')); 
           WizardForm.ComponentsList.ItemEnabled[ItemIndex] := False; 
        if RegQueryStringValue(HKLM, 'Software\COMPANY\{#RegProduct}\{#RegCurVer}', 'Install-DEU', InstallDe) then 
         if ((InstallDe = 'German Pack') 
         or (InstallDe = 'Pack Allemand') 
         or (InstallDe = 'Deutsches Paket')) 
          then 
           ItemIndex := WizardForm.ComponentsList.Items.IndexOf(CustomMessage('CompDescDe')); 
           WizardForm.ComponentsList.ItemEnabled[ItemIndex] := False; 
        # After I try to say if all component are install, close the wizard. 
        CompDescEnIndex := WizardForm.ComponentsList.Items.IndexOf(CustomMessage('CompDescEn')); 
        CompDescFrIndex := WizardForm.ComponentsList.Items.IndexOf(CustomMessage('CompDescFr')); 
        CompDescDeIndex := WizardForm.ComponentsList.Items.IndexOf(CustomMessage('CompDescDe')); 
        if not WizardForm.ComponentsList.ItemEnabled[CompDescEnIndex] 
         and not WizardForm.ComponentsList.ItemEnabled[CompDescFrIndex] 
         and not WizardForm.ComponentsList.ItemEnabled[CompDescDeIndex] 
        then 
         Check := 1; 
        if (Check <> 0) then 
         WizardForm.Close; 
    end; 
    

    注:コードは非常にきれいではないかもしれないが、私はパスカル+ Inno Setupの中で始めた私はいくつかの研究ここや他のウェブサイト上に作りましたし、私は次の操作を行う必要があり

Codeセクション私のすべてのコンポーネントがインストール(および選択できません)している場合は

は、私が...

私はwpFinishedページに直接移動するための解決策を見つけることができない...ウィザードが継続停止しないようにありたいですそれを行う方法?

私のケースではWizardForm.Close;が機能しないようであるため、すべてのコンポーネントがインストールされている場合、ウィザードを停止するにはどうすればよいですか?

ありがとうございました。

答えて

1

ページにスキップすることはできません.Inno Setupは、完全自動化されたインストーラ(悪用される可能性があります)を作成しないように、wpReadyページをスキップすることはできません。


カスタムを作成することができますは、しかしページの "終了":

enter image description here

procedure AllInstalledPageActivate(Sender: TWizardPage); 
begin 
    { Change the "Next" button to "Finish" on our custom page } 
    WizardForm.NextButton.Caption := SetupMessage(msgButtonFinish); 
    { Hide the "Cancel" button } 
    WizardForm.CancelButton.Visible := False; 
end; 

procedure ExitProcess(uExitCode: UINT); 
    external '[email protected] stdcall'; 

function AllInstalledPageNextButtonClick(Sender: TWizardPage): Boolean; 
begin 
    { Abort the installer when the "Finish" button is clicked on our custom page } 
    ExitProcess(0); 
    Result := True; { shut up the compiler warning } 
end; 

procedure InitializeWizard(); 
var 
    Caption: TLabel; 
    AllInstalledPage: TWizardPage; 
begin 
    ... 

    { If everything is installed already ... } 
    if IsEverythingInstalled then 
    begin 
    { ... create a custom "everything is installed" page } 
    AllInstalledPage := 
     CreateCustomPage(
     wpWelcome, 'All components are installed already', 
     'There''s nothing to install.'); 

    AllInstalledPage.OnActivate := @AllInstalledPageActivate; 
    AllInstalledPage.OnNextButtonClick := @AllInstalledPageNextButtonClick; 

    Caption := TLabel.Create(AllInstalledPage); 
    Caption.Caption := 
     'Everything is installed already. Click Finish to close the installer.'; 
    Caption.Width := AllInstalledPage.SurfaceWidth; 
    Caption.Parent := AllInstalledPage.Surface; 
    end; 
end; 

をしても簡単な解決策は、プレーンmessage boxを使用することです。


Wizard.Close

は、それはとにかく、「完了」ページには行かないだろう、インストーラを閉じます。インストーラを中止したい場合は、 InitializeSetupから Falseを返します(コードの一部を InitializeSetupに移動する必要があります)。

または、私の例のようにExitProcess functionを使用してください。

関連する問題