the IsServer value in the registry as the return value of InstallAsServer
< p>
[Code]
[Registry]
Root: HKLM; Subkey: "Software\company\product\Settings"; ValueType: string; ValueName: "IsServer"; ValueData : {code:InstallAsServer}
var
Page: TInputOptionWizardPage;
IsServer: Boolean;
procedure InitializeWizard;
begin
Page := CreateInputOptionPage(wpWelcome,
'Install Type','Select Install Type',
'Please select Installation type; If Server click Server else Client',
True, False);
// Add items
Page.Add('Install as Server');
Page.Add('Install as Client');
// Set initial values (optional)
Page.Values[0] := True;
Page.Values[1] := False;
IsServer := Page.Values[0];
end;
function InstallAsServer(emppararm: string): string; //emppararm not used just for syntax
begin
if (IsServer=False) then
begin
result:= '0';
end
else
begin
result:= '1';
end
end;
But even if I select server or client in the page, I always set the value to 1
[Registry]
Root: HKLM; Subkey: "Software\company\product\Settings"; ValueType: string; ValueName: "IsServer"; ValueData: {code:InstallAsServer}
[Code]
var
Page: TInputOptionWizardPage;
procedure InitializeWizard;
begin
Page := CreateInputOptionPage(wpWelcome,'Install Type','Select Install Type',
'Please select Installation type; If Server click Server else Client', True, < br /> False);
// add items
Page.Add('Install as Server');
Page.Add('Install as Client');
// set initial values (optional)
Page.Values[0] := True;
Page .Values[1] := False;
end;
function InstallAsServer(Value: string): string;
begin
// read the actual value directly from the Page
if not Page.Values[0] then
Result := '0'
else
Result := '1';
end;
How to use the value in the function to add a registry key in innosetup. I want to set the
IsServer value in the registry as the return value of InstallAsServer
[Code]
[Registry]
Root: HKLM; Subkey: "Software\company\product\Settings"; ValueType: string; ValueName: "IsServer"; ValueData: {code:InstallAsServer}
var
Page: TInputOptionWizardPage;
IsServer: Boolean;
procedure InitializeWizard;
begin
Page: = CreateInputOptionPage(wpWelcome,
'Install Type','Select Install Type',
'Please select Installation type; If Server click Server else Client',
True, False);
// Add items
Page.Add('Install as Server');
Page.Add('Install as Client');
// Set initial values (optional)
Page.Values[0] := True;
Page.Values[1] := False;
IsServer := Page.Values[0];
end;
function InstallAsServer(emppararm: string): string; //emppararm not used just for syntax
begin
if (IsServer=False) then
begin
result := '0';
end
else
begin
result:= '1';
end
end;
But even if I select server or client in the page, I always set the value to 1
This is because you are only in the wizard form Assign the value of the IsServer variable during initialization. You need to ideally read the actual value from the InstallAsServer function, so you can even delete the IsServer variable. You can simplify the code to the following:
p>
[Registry]
Root: HKLM; Subkey: "Software\company\product\Settings"; ValueType: string; ValueName: "IsServer"; ValueData: {code:InstallAsServer}
< br />[Code]
var
Page: TInputOptionWizardPage;
procedure InitializeWizard;
begin
Page := CreateInputOptionPage(wpWelcome,'Install Type' ,'Select Install Type',
'Please select Installation type; If Server click Server else Client', True,
False);
// add items
Page.Add('Install as Server');
Page.Add('Install as Client');
< br /> // set initial values (optional)
Page.Values[0] := True;
Page.Values[1] := False;
end;
< br />function InstallAsServer(Value: string): string;
begin
// read the actual value directly from the Page
if not Page.Values[0] then
Result := '0'
else
Result := '1';
end;