AllPagesExample.iss 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. OutputProgressWizardPageAfterID: Integer;
  38. procedure InitializeWizard;
  39. var
  40. InputQueryWizardPage: TInputQueryWizardPage;
  41. InputOptionWizardPage: TInputOptionWizardPage;
  42. InputDirWizardPage: TInputDirWizardPage;
  43. InputFileWizardPage: TInputFileWizardPage;
  44. OutputMsgWizardPage: TOutputMsgWizardPage;
  45. OutputMsgMemoWizardPage: TOutputMsgMemoWizardPage;
  46. AfterID: Integer;
  47. begin
  48. WizardForm.PasswordEdit.Text := '{#Password}';
  49. AfterID := wpSelectTasks;
  50. AfterID := CreateCustomPage(AfterID, 'CreateCustomPage', 'ADescription').ID;
  51. InputQueryWizardPage := CreateInputQueryPage(AfterID, 'CreateInputQueryPage', 'ADescription', 'ASubCaption');
  52. InputQueryWizardPage.Add('&APrompt:', False);
  53. AfterID := InputQueryWizardPage.ID;
  54. InputOptionWizardPage := CreateInputOptionPage(AfterID, 'CreateInputOptionPage', 'ADescription', 'ASubCaption', False, False);
  55. InputOptionWizardPage.Add('&AOption');
  56. AfterID := InputOptionWizardPage.ID;
  57. InputDirWizardPage := CreateInputDirPage(AfterID, 'CreateInputDirPage', 'ADescription', 'ASubCaption', False, 'ANewFolderName');
  58. InputDirWizardPage.Add('&APrompt:');
  59. InputDirWizardPage.Values[0] := 'C:\';
  60. AfterID := InputDirWizardPage.ID;
  61. InputFileWizardPage := CreateInputFilePage(AfterID, 'CreateInputFilePage', 'ADescription', 'ASubCaption');
  62. InputFileWizardPage.Add('&APrompt:', 'Executable files|*.exe|All files|*.*', '.exe');
  63. AfterID := InputFileWizardPage.ID;
  64. OutputMsgWizardPage := CreateOutputMsgPage(AfterID, 'CreateOutputMsgPage', 'ADescription', 'AMsg');
  65. AfterID := OutputMsgWizardPage.ID;
  66. OutputMsgMemoWizardPage := CreateOutputMsgMemoPage(AfterID, 'CreateOutputMsgMemoPage', 'ADescription', 'ASubCaption', 'AMsg');
  67. AfterID := OutputMsgMemoWizardPage.ID;
  68. OutputProgressWizardPage := CreateOutputProgressPage('CreateOutputProgressPage', 'ADescription');
  69. OutputProgressWizardPageAfterID := AfterID;
  70. end;
  71. function NextButtonClick(CurPageID: Integer): Boolean;
  72. var
  73. Position, Max: Integer;
  74. begin
  75. if CurPageID = OutputProgressWizardPageAfterID then begin
  76. try
  77. Max := 25;
  78. for Position := 0 to Max do begin
  79. OutputProgressWizardPage.SetProgress(Position, Max);
  80. if Position = 0 then
  81. OutputProgressWizardPage.Show;
  82. Sleep(2000 div Max);
  83. end;
  84. finally
  85. OutputProgressWizardPage.Hide;
  86. end;
  87. end;
  88. Result := True;
  89. end;
  90. function PrepareToInstall(var NeedsRestart: Boolean): String;
  91. begin
  92. if SuppressibleMsgBox('Do you want to stop Setup at the Preparing To Install wizard page?', mbConfirmation, MB_YESNO, IDNO) = IDYES then
  93. Result := 'Stopped by user';
  94. end;