我正在为我的 Windows .NET 应用程序使用 Inno Setup。我在询问用户是否要使用以下代码在 Windows 上启动应用程序:
[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;
如何添加注册表项而不是消息框?
我知道我可以无条件地做到这一点:
[Registry]
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; \
ValueName: "key"; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletevalue