【问题标题】:Is it possible to add HTML form in Inno setup?是否可以在 Inno 设置中添加 HTML 表单?
【发布时间】:2022-02-08 22:15:30
【问题描述】:

我为游戏创建了一个自定义安装程序。我需要使用新功能更新安装程序的版本。游戏需要注册才能在线玩。所以我需要从网页嵌入注册表单(或者在安装完成后直接使用 HTML 代码到 Inno Setup 页面中。所以人们不需要访问页面并能够通过 Inno Setup 在线注册游戏。

【问题讨论】:

    标签: inno-setup


    【解决方案1】:

    在安装程序中创建一个带有嵌入式浏览器的新页面。

    我推荐使用这个组件:https://code.google.com/p/inno-web-browser/

    用法很简单:https://code.google.com/p/inno-web-browser/source/browse/trunk/Example.iss

    当用户前进到您的(新创建的)页面时,导航到您的网站(应该在服务器上的某个位置运行)。

    【讨论】:

    • 我不确定,但我认为 TLama 编写了那个组件?
    【解决方案2】:

    没有原生支持将网页包含到 Inno Setup 安装程序中。我也不知道有任何支持它的 3rd 方扩展。


    相反,您可以使用CreateInputQueryPage function 编写自定义安装程序页面来查询用户注册详细信息并将其发送到您的网站。

    一个简单的例子:

    [Code]
    var
      UserPage: TInputQueryWizardPage;
      
    procedure InitializeWizard;
    begin
      UserPage := CreateInputQueryPage(wpWelcome,
        'Registration', 'Who are you?',
        'Please specify your name and username tor register, then click Next.');
      UserPage.Add('Name:', False);
      UserPage.Add('User name:', False);
    end;
    
    function NextButtonClick(CurPageID: Integer): Boolean;
    begin
      Result := True;
    
      if CurPageID = UserPage.ID then
      begin
        if (UserPage.Values[0] = '') or (UserPage.Values[1] = '') then
        begin
          MsgBox('You must enter your name and username.', mbError, MB_OK);
          Result := False;
        end;
      end;
    end;
    
    procedure CurStepChanged(CurStep: TSetupStep);
    var
      WinHttpReq: Variant;
      RegisterUrl: string;
    begin
      if CurStep = ssDone then
      begin
        try
          RegisterUrl :=
            'https://www.example.com/register.php?' +
              Format('name=%s&username=%s', [UserPage.Values[0], UserPage.Values[1]])
    
          Log('Sending registration request: ' + RegisterUrl);
    
          WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
          WinHttpReq.Open('GET', RegisterUrl, False);
          WinHttpReq.Send('');
    
          Log('Registration report send result: ' +
              IntToStr(WinHttpReq.Status) + ' ' + WinHttpReq.StatusText);
        except
          Log('Error sending registration report: ' + GetExceptionMessage);
        end;
      end;
    end;
    

    (请注意,这缺少数据的 URL 编码)。


    或者只是在安装结束时在网络浏览器中打开注册表。

    [Run]
    Filename: "https://www.example.com/register.php"; \
        Description: "&Open registration form"; \
        Flags: shellexec runasoriginaluser postinstall
    

    【讨论】:

      猜你喜欢
      • 2020-06-26
      • 1970-01-01
      • 1970-01-01
      • 2012-11-18
      • 2020-09-04
      • 2020-01-24
      • 2021-07-27
      • 2020-06-16
      • 1970-01-01
      相关资源
      最近更新 更多