如何检查和修复InnoSetup项目中的组件? [英] How to check and fix a component in a InnoSetup project?

查看:315
本文介绍了如何检查和修复InnoSetup项目中的组件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个InnoSetup项目,我想知道如何始终安装一个组件(比如说"Acrobat Reader"),但是不允许取消选中组件列表中的该项目.
我不希望用户取消选中它.

I'm developing a InnoSetup project and I'm wondering how to always install a component (let's say 'Acrobat Reader') but don't allow to uncheck that item in the list of components.
I don't want the user uncheck it.

推荐答案

通常,在

Generally, a component is selected when the selected installation type is listed in the Types parameter of its entry. So if you list all the available installation types there, it will be selected always.

要禁用该组件以使用户无法修改其状态,您需要包括 fixed 条目的标志.

To disable the component so that users cannot modify its state, you need to include the fixed flag for the entry.

因此,要使禁用的,始终选择的组件具有默认安装类型(当您未在

So to make a disabled, always selected component with default installation types (which are used when you don't specify your own installation types in the [Types] section), you would write entry like this:

[Components]
Name: "main"; Description: "Main Files"; Types: full compact custom; Flags: fixed


在您的评论中,您询问了如何禁用任务条目.据我所知,没有直接的方法可以做到这一点,而我想出的唯一方法就是在


In your comment you've asked how to disable a task entry. As far as I know, there is no direct way to do this and the only way I could come up with is doing this in code from the CurPageChanged event:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Tasks]
Name: something; Description: "Install something"

[Code]
procedure CurPageChanged(CurPageID: Integer);
begin
  // the ItemEnabled property uses a 0 based index for item access, so the following
  // code you can read as, if we have entered the tasks selection page, disable the
  // first tasks list item
  if CurPageID = wpSelectTasks then
    WizardForm.TasksList.ItemEnabled[0] := False;
end;

这篇关于如何检查和修复InnoSetup项目中的组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆