我正在使用inno设置我的Windows .net应用程序,我问用户是否要使用以下代码启动应用程序:
[Tasks]
Name: "TaskEntry"; Description: "Start with Windows?"; GroupDescription: "Startup";
[code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
if CurPageID = wpSelectTasks then
begin
if WizardForm.TasksList.Checked[3] then
MsgBox('Startup has been checked.', mbInformation, MB_OK)
else
MsgBox('Startup has not been checked.', mbInformation, MB_OK);
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpSelectTasks then
WizardForm.TasksList.Checked[3] := False;
end;
如何添加注册表项而不是msgbox?
我知道我可以无条件地使用
[Registry]
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "key"; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletevalue
答案 0 :(得分:3)
您不需要任何代码。在注册表项中添加“Tasks”参数,只有在用户选择了此任务时才会处理该参数:
[Registry]
Root: HKCU; Subkey: "Software\ [...] Flags: uninsdeletevalue; Tasks: TaskEntry