Eugene Mala
Eugene Mala

Reputation: 1293

Change AppVerName and DefaultGroupName based on user input

I want my installer to ask user how program should be named in "Add\Remove Programs". I want to add custom wizard pages for this. There are no problems with custom wizard pages, but I do not know how to change AppVerName after wizard has been shown. I already tried:

[Setup]
AppVerName={code:GetUserAppName}
DefaultDirName={pf}\{code:GetUserAppName}
DefaultGroupName={code:GetUserAppName}

[Code]
var
  AppUserName: String;

function GetUserAppName(param: String): String;
begin
  Result := AppUserName;
end;

But function GetUserAppName is called too early, before I have any chance to ask user for program name. And this function is not called after wizard is displayed or before installing.

Are there any possibility to change AppVerName from code, for example in NextButtonClick event?

P.S. There is already similar question: Changing AppID and AppName based on user input, but accepted answer is totally wrong, because his author asked wrong question:

I found answers to my own question and then realised maybe I was not asking the question correctly.

Upvotes: 3

Views: 312

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202444

There's UninstallDisplayName directive, which is resolved only during the actual installation, when you already know the name. So you can use your GetUserAppName here:

[Setup]
UninstallDisplayName={code:GetUserAppName}

See also Inno Setup Change AppName based on component(s) selected.

Upvotes: 1

Related Questions