AllPagesExample.iss 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. ; -- AllPagesExample.iss --
  2. ; Same as Example1.iss, but shows all the wizard pages Setup may potentially display
  3. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!
  4. [Setup]
  5. AppName=My Program
  6. AppVersion=1.5
  7. WizardStyle=modern
  8. DefaultDirName={autopf}\My Program
  9. DefaultGroupName=My Program
  10. UninstallDisplayIcon={app}\MyProg.exe
  11. Compression=lzma2
  12. SolidCompression=yes
  13. OutputDir=userdocs:Inno Setup Examples Output
  14. DisableWelcomePage=no
  15. LicenseFile=license.txt
  16. #define Password 'password'
  17. Password={#Password}
  18. InfoBeforeFile=readme.txt
  19. UserInfoPage=yes
  20. PrivilegesRequired=lowest
  21. DisableDirPage=no
  22. DisableProgramGroupPage=no
  23. InfoAfterFile=readme.txt
  24. [Files]
  25. Source: "MyProg.exe"; DestDir: "{app}"
  26. Source: "MyProg.chm"; DestDir: "{app}"
  27. Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
  28. [Icons]
  29. Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"
  30. [Components]
  31. Name: "component"; Description: "Component";
  32. [Tasks]
  33. Name: "task"; Description: "Task";
  34. [Code]
  35. var
  36. OutputProgressWizardPage: TOutputProgressWizardPage;
  37. OutputMarqueeProgressWizardPage: TOutputMarqueeProgressWizardPage;
  38. OutputProgressWizardPagesAfterID: Integer;
  39. procedure InitializeWizard;
  40. var
  41. InputQueryWizardPage: TInputQueryWizardPage;
  42. InputOptionWizardPage: TInputOptionWizardPage;
  43. InputDirWizardPage: TInputDirWizardPage;
  44. InputFileWizardPage: TInputFileWizardPage;
  45. OutputMsgWizardPage: TOutputMsgWizardPage;
  46. OutputMsgMemoWizardPage: TOutputMsgMemoWizardPage;
  47. AfterID: Integer;
  48. begin
  49. WizardForm.LicenseAcceptedRadio.Checked := True;
  50. WizardForm.PasswordEdit.Text := '{#Password}';
  51. WizardForm.UserInfoNameEdit.Text := 'Username';
  52. AfterID := wpSelectTasks;
  53. AfterID := CreateCustomPage(AfterID, 'CreateCustomPage', 'ADescription').ID;
  54. InputQueryWizardPage := CreateInputQueryPage(AfterID, 'CreateInputQueryPage', 'ADescription', 'ASubCaption');
  55. InputQueryWizardPage.Add('&APrompt:', False);
  56. AfterID := InputQueryWizardPage.ID;
  57. InputOptionWizardPage := CreateInputOptionPage(AfterID, 'CreateInputOptionPage', 'ADescription', 'ASubCaption', False, False);
  58. InputOptionWizardPage.Add('&AOption');
  59. AfterID := InputOptionWizardPage.ID;
  60. InputDirWizardPage := CreateInputDirPage(AfterID, 'CreateInputDirPage', 'ADescription', 'ASubCaption', False, 'ANewFolderName');
  61. InputDirWizardPage.Add('&APrompt:');
  62. InputDirWizardPage.Values[0] := 'C:\';
  63. AfterID := InputDirWizardPage.ID;
  64. InputFileWizardPage := CreateInputFilePage(AfterID, 'CreateInputFilePage', 'ADescription', 'ASubCaption');
  65. InputFileWizardPage.Add('&APrompt:', 'Executable files|*.exe|All files|*.*', '.exe');
  66. AfterID := InputFileWizardPage.ID;
  67. OutputMsgWizardPage := CreateOutputMsgPage(AfterID, 'CreateOutputMsgPage', 'ADescription', 'AMsg');
  68. AfterID := OutputMsgWizardPage.ID;
  69. OutputMsgMemoWizardPage := CreateOutputMsgMemoPage(AfterID, 'CreateOutputMsgMemoPage', 'ADescription', 'ASubCaption', 'AMsg');
  70. AfterID := OutputMsgMemoWizardPage.ID;
  71. OutputProgressWizardPage := CreateOutputProgressPage('CreateOutputProgressPage', 'ADescription');
  72. OutputMarqueeProgressWizardPage := CreateOutputMarqueeProgressPage('CreateOutputMarqueeProgressPage', 'ADescription');
  73. OutputProgressWizardPagesAfterID := AfterID;
  74. { See CodeDownloadFiles.iss for a CreateDownloadPage example }
  75. end;
  76. function NextButtonClick(CurPageID: Integer): Boolean;
  77. var
  78. I, Max: Integer;
  79. begin
  80. if CurPageID = OutputProgressWizardPagesAfterID then begin
  81. try
  82. Max := 50;
  83. for I := 0 to Max do begin
  84. OutputProgressWizardPage.SetProgress(I, Max);
  85. if I = 0 then
  86. OutputProgressWizardPage.Show;
  87. Sleep(2000 div Max);
  88. end;
  89. finally
  90. OutputProgressWizardPage.Hide;
  91. end;
  92. try
  93. Max := 50;
  94. OutputMarqueeProgressWizardPage.Show;
  95. for I := 0 to Max do begin
  96. OutputMarqueeProgressWizardPage.Animate;
  97. Sleep(2000 div Max);
  98. end;
  99. finally
  100. OutputMarqueeProgressWizardPage.Hide;
  101. end;
  102. end;
  103. Result := True;
  104. end;
  105. function PrepareToInstall(var NeedsRestart: Boolean): String;
  106. begin
  107. if SuppressibleMsgBox('Do you want to stop Setup at the Preparing To Install wizard page?', mbConfirmation, MB_YESNO, IDNO) = IDYES then
  108. Result := 'Stopped by user';
  109. end;