如何在安装过程中记录用户输入,以便可以在卸载期间使用? [英] How do I record user input during install, so it can be used during uninstall?

查看:49
本文介绍了如何在安装过程中记录用户输入,以便可以在卸载期间使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装过程中,我记录了用户的输入,例如正在创建的Windows服务的名称.卸载此服务时,我需要知道用户最初输入的名称是什么.

During setup I record input from the user such as the name of the windows service that is being created. When uninstalling this service I need to know what was originally entered as service name by the user.

在卸载过程中获取服务名称的最佳方法是什么?

What is the best way to get the service name during uninstall?

推荐答案

最符合您要求的方法似乎是处理 SetPreviousData 函数,您可以在其中将字符串值存储在自定义键下.要恢复以前存储的数据,可以调用 GetPreviousData 函数.

The best fitting to your requirement seems to be to handle the RegisterPreviousData event method and from inside it call the SetPreviousData function, in which you can store a string value under your custom key. To restore the previously stored data you can call GetPreviousData function.

这是用法的一个简单示例:

Here is a simple example of the usage:

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

[Code]
var
  UserPage: TInputQueryWizardPage;

procedure InitializeWizard;
begin
  UserPage := CreateInputQueryPage(wpWelcome, 'Caption', 'Description', '');
  UserPage.Add('Service name:', False);
end;

procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
  SetPreviousData(PreviousDataKey, 'ServiceName', UserPage.Values[0]);
end;

function InitializeUninstall: Boolean;
var
  ServiceName: string;
begin
  ServiceName := GetPreviousData('ServiceName', '');
  if ServiceName <> '' then
    MsgBox('The value entered before: ' + ServiceName, mbInformation, MB_OK);
end;

这篇关于如何在安装过程中记录用户输入,以便可以在卸载期间使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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