Adding user completed form to Inno Setup

2019-05-19 22:09发布

I would like to add a small form, to be filled out by the user at time of program installation, using Inno Setup. The form then needs to be emailed back to me and a pre-defined email address.

The form needs in few fields like;

  • User Name
  • Address
  • Email
  • Phone # etc.

Once I have an example, I would hopefully be able to refine the fields I am looking for.

Any help with this would be appreciated, other wise I am very happy with the performance of Inno Setup, and have been able to perform all other tasks.

标签: inno-setup
1条回答
相关推荐>>
2楼-- · 2019-05-19 23:03

For the data capture, you can call the CreateInputQueryPage function to create a new page inside the wizard.

The page is specialized in get input in form of edits.

Example:

[Code]
var
  Page: TInputQueryWizardPage;
  UserName, UserCompany: String;

procedure InitializeWizard();
begin
  Page := CreateInputQueryPage(wpWelcome,
  'Personal Information', 'Who are you?',
  'Please specify your name and the company for whom you work, then click Next.');

  { Add items (False means it's not a password edit) }
  Page.Add('Name:', False);
  Page.Add('Company:', False);

  { Set initial values (optional) }
  Page.Values[0] := ExpandConstant('{sysuserinfoname}');
  Page.Values[1] := ExpandConstant('{sysuserinfoorg}');
end;

For the email part, since Inno Setup lacks of send e-mail support, my advise is

  • to create a simple application specialized in sending the email, include it as part of your installation and call it once the form is completed
  • Look for Inno Setup extensions, maybe is there support for sending emails (I'm not aware of)
  • instead of direct email send, you can create a web bridge: a simple web page in your site which receive the information via get parameters and then send you a email. Since you can perform this get via windows API calls it will be easier to implement directly inside Inno Setup. This is not the most secure approach, as if someone discovers it may be abused to send you fake emails, but you can code to minimize the chance.
查看更多
登录 后发表回答