不知道应该发到哪个版面上. 
问一个关于inno setup的问题,怎么在code中判断某个组件已选,组件页面的变量名是什么呢? 

解决方案 »

  1.   

    仔细看看Inno Step的帮助文件!!里面应该会有答案的
      

  2.   

    为什么要判断组件已选?是要类似 Office 安装那样的效果吗?
      

  3.   

    Inno 好象实现不了
    它只不过是最简单的打包软件罢了
    要想 实现你要求的效果 建议用My InstallShield 
    这个功能非常强大,用起来也不是很麻烦
      

  4.   

    My InstallShield 
    也是开源的软件吗?
      

  5.   

    如果是在
    wpSelectComponents页面的话,
    [Types]
    Name: "custom"; Description: "自定义安装"; Flags: iscustom
    Name: "full"; Description: "完全安装"[Components]
    Name: "mainApplication"; Description: "服务器应用主程序"; Types: custom full; Flags: fixed
    Name: "authority"; Description: "权限管理文件"; Types: full
    Name: "database"; Description: "数据库"; Types: fullvar ComponentsSelected: string
    [Code]
    function NextButtonClick(CurPageID: Integer): Boolean;
    begin
    if CurPageID=wpSelectComponents then
         ComponentsSelected:=WizardselectedComponents(True);
         if (Pos('数据库',ComponentsSelected)>0 then
          begin
             { do what you want }
          end;
      

  6.   

    inno自带的Demo中有个CodeExample1.iss你可以参考[Files]
    Source: "MyProg.exe"; DestDir: "{app}"; Check: MyProgCheck; BeforeInstall: BeforeMyProgInstall('MyProg.exe'); AfterInstall: AfterMyProgInstall('MyProg.exe')其中AfterInstall: AfterMyProgInstall的AfterMyProgInstall是个自定义的执行过程procedure AfterMyProgInstall(S: String);
    begin
      MsgBox('AfterMyProgInstall:' #13#13 'Setup just installed ' + S + ' as ' + CurrentFileName + '.', mbInformation, MB_OK);
    end;
      

  7.   

    每个组件你可以设置一个注册表的值,下面三个函数可以对注册表进行判断、取值、写值操作。
    RegKeyExists
    RegQueryStringValue
    RegWriteStringValue
      

  8.   

    语法:
    function IsComponentSelected(const Components: String): Boolean;描述:
    如果选定了指定的组件则返回 True。可以在同一方式用一个组件参数指定多个组件。示例:
    begin
      if IsComponentSelected('helpfiles') then
        // the 'helpfiles' component is selected
    end;
      

  9.   

    楼上的使用方法更简单
    至于 如何[code]段中执行MSI格式的程序的脚本我只在[Run]段执行过MSI格式的程序的脚本
    [Run]
    Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\abc.msi"" /quiet";