在CreateInputQueryPage之前发生我想要的Inno Setup操作。为什么?

时间:2015-01-28 18:18:28

标签: inno-setup

运行我的Inno Setup内置安装程序时,由于CreateInputQueryPage中的选择而发生的操作发生在CreateInputQueryPage打开并从用户获取输入之前。我错过了什么概念?

我需要使用NextButtonClick吗?

以下是基于代码(http://www.jrsoftware.org/ishelp)的Pascal代码:

[Code]
procedure UserGroup;
Var  Page : TInputQueryWizardPage;
  GroupName : String;
  Message: String;
  ResultCode: Integer;
begin
  // Create page
  Page := CreateInputQueryPage(wpWelcome,
    'Users Group Required', 
    'Please specify group, then click Next',
    'A Windows security group must be created.'
    );

  // Add items (False means it's not a password edit)
  Page.Add('GroupName:', False);
  Page.Values[0] := 'SomeGroup';

  // Read values into variables
  GroupName := Page.Values[0];
  if Exec('net.exe', Format( 'localgroup %s /add',[GroupName]), '', SW_SHOW,
     ewWaitUntilTerminated, ResultCode) then
  begin
    // success 
    Message := Format('The user group %s has been added to the local machine.', [GroupName]);
    MsgBox( Message, mbInformation, MB_OK);
  end
  else begin
    // failure i
    Message := Format('The installer was not able to set up the %s security group. Please do so manually. (Inno Error Code: %i)', [GroupName, ResultCode]);
    MsgBox( Message, mbInformation, MB_OK);
  end;
end;

但是MsgBox在CreateInputQueryPage之前显示。

0 个答案:

没有答案