Advertisement
deejay007

Inno_Sample_SkipPages

Mar 25th, 2015
2,886
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [Code]
  2.  
  3. var
  4. PageSQL2008SetupFile2: Integer;
  5. PageSQL2008R2SetupFile2: Integer;
  6. PageSQL2012SetupFile2: Integer;
  7. PageSQL2014SetupFile2: Integer;
  8.  
  9. procedure InitializeWizard();
  10. begin
  11.     MyModeTypical := false;
  12.  
  13.         PageProductName := CreateInputQueryPage(wpSelectComponents,
  14.         'Settings',
  15.         'Product Name',
  16.         'Please specify the product name, then click Next.');
  17.        
  18.         PageProductName.Add('Product Name:', False);
  19.         PageProductName.Values[0] := ProductName;
  20. //SQL Server selection page
  21.         PageSQLServerSelection := CreateInputOptionPage(PageProductName.ID,
  22.         'SQL Server Selection', 'Please select the version of SQL Server you want to install.',
  23.         '',
  24.         True, False);
  25.        
  26.         PageSQLServerSelection.Add('SQL 2008');
  27.         PageSQLServerSelection.Add('SQL 2008R2');
  28.         PageSQLServerSelection.Add('SQL 2012');
  29.         PageSQLServerSelection.Add('SQL 2014');
  30.    
  31.         PageSQLServerSelection.Values[0] := False;
  32.         PageSQLServerSelection.Values[1] := False;
  33.         PageSQLServerSelection.Values[2] := False;
  34.         PageSQLServerSelection.Values[3] := False;
  35.        
  36. // Creating Setup pages for the 4 servers
  37.         PageSQL2008SetupFile2 := MSSQL2008SETUPDIR_CreatePage(PageSQLServerSelection.ID);
  38.            
  39.         PageSQL2008R2SetupFile2 := MSSQL2008R2SETUPDIR_CreatePage(PageSQL2008SetupFile2);
  40.            
  41.         PageSQL2012SetupFile2 := MSSQL2012SETUPDIR_CreatePage(PageSQL2008R2SetupFile2);
  42.            
  43.         PageSQL2014SetupFile2 := MSSQL2014SETUPDIR_CreatePage(PageSQL2012SetupFile2);
  44.  
  45. // some more logic...
  46.  
  47. end;
  48.  
  49. // Function for creating the Setup pages for 4 SQL Servers (Same logic for all 4 servers)
  50.  
  51. function MSSQL2008SETUPDIR_CreatePage(PreviousPageId: Integer): Integer;
  52. var
  53.   Page: TWizardPage;
  54.   BMPFile: String;
  55. begin
  56.   SelectedSQLServerVersion := GetSQLServerVersion('');
  57.   Page := CreateCustomPage(
  58.     PreviousPageId,
  59.     ExpandConstant('Database Settings'),
  60.     ExpandConstant('Special note for the Microsoft SQL Server 2008 Setup')
  61.   );
  62.  
  63.     BMPFile:= ExpandConstant('{tmp}\caution.bmp');
  64.     if not FileExists(BMPFile) then ExtractTemporaryFile(ExtractFileName(BMPFile));
  65. { BitmapImage1 }
  66.   BitmapImage1 := TBitmapImage.Create(Page);
  67.   with BitmapImage1 do
  68.   begin
  69.     Bitmap.LoadFromFile(BMPFile);
  70.     Parent := Page.Surface;
  71.     Left := ScaleX(8);
  72.     Top := ScaleY(8);
  73.     Width := ScaleX(97);
  74.     Height := ScaleY(209);
  75.   end;
  76.   { NewStaticText1 }
  77.   NewStaticText1 := TNewStaticText.Create(Page);
  78.   with NewStaticText1 do
  79.   begin
  80.     Parent := Page.Surface;
  81.     Caption := 'To install Microsoft SQL Server 2008 you have to insert the Microsoft SQL Server 2008 Setup CD, when XXX setup requests it. The installation path of your Microsoft SQL Server 2008 setup and the additional Service Packs can be defined on the next pages.';
  82.     Left := ScaleX(112);
  83.     Top := ScaleY(8);
  84.     Width := ScaleX(292);
  85.     Height := ScaleY(77);
  86.     AutoSize := False;
  87.     TabOrder := 0;
  88.     WordWrap := True;
  89.   end;
  90.  
  91.   { NewStaticText2 }
  92.   NewStaticText2 := TNewStaticText.Create(Page);
  93.   with NewStaticText2 do
  94.   begin
  95.     Parent := Page.Surface;
  96.     Caption :=
  97.       'CAUTION: When autorun is activated, dont click in the autorun menu of Microsoft SQL Server 2008.' + #13 +
  98.       'Otherwise you must reboot your machine and restart the setup !';
  99.     Left := ScaleX(112);
  100.     Top := ScaleY(88);
  101.     Width := ScaleX(293);
  102.     Height := ScaleY(62);
  103.     AutoSize := False;
  104.     Font.Color := -16777208;
  105.     Font.Height := ScaleY(-11);
  106.     Font.Name := 'Tahoma';
  107.     Font.Style := [fsBold];
  108.     ParentFont := False;
  109.     TabOrder := 1;
  110.     WordWrap := True;
  111.   end;
  112.  
  113.   with Page do
  114.   begin
  115.     //OnActivate := @MSSQLSETUPDIR_Activate;
  116.     //OnShouldSkipPage := @MSSQLSETUPDIR_ShouldSkipPage;
  117.     //OnBackButtonClick := @MSSQLSETUPDIR_BackButtonClick;
  118.     //OnNextButtonClick := @MSSQLSETUPDIR_NextButtonClick;
  119.     //OnCancelButtonClick := @MSSQLSETUPDIR_CancelButtonClick;
  120.   end;
  121.  
  122.   Result := Page.ID;
  123. end;
  124.  
  125. function ShouldSkipPage(PageID: Integer): Boolean;
  126.  
  127. var
  128.    
  129. begin
  130.     if PageID = wpSelectComponents then begin
  131.         Result := MyModeTypical;
  132.     end else if PageID = PageProductName.ID then begin
  133.         Result := MyModeTypical;
  134.     end;
  135.     Log('Server is...' + SelectedSQLServerVersion);
  136.     if SelectedSQLServerVersion <> '' then begin
  137.     // Database Settings Warning
  138.         if (SQLServer2008Flag = True) and (IsComponentSelected('DBS\SERVER')) then begin
  139.             if PageID = PageSQL2008SetupFile2 then begin
  140.                 Result := false;
  141.             end else if PageID = PageSQL2008R2SetupFile2 then begin
  142.                 Result := true;
  143.             end else if PageID = PageSQL2012SetupFile2 then begin
  144.                 Result := true;
  145.             end else if PageID = PageSQL2014SetupFile2 then begin
  146.                 Result := true;
  147.             end;
  148.        
  149.         end else if (SQLServer2008R2Flag = True) and (IsComponentSelected('DBS\SERVER')) then begin
  150.             if PageID = PageSQL2008R2SetupFile2 then begin
  151.                 Result := false;
  152.             end else if PageID = PageSQL2012SetupFile2 then begin
  153.                 Result := true;
  154.             end else if PageID = PageSQL2014SetupFile2 then begin
  155.                 Result := true;
  156.             end else if PageID = PageSQL2008SetupFile2 then begin
  157.                 Result := true;
  158.             end;
  159.        
  160.         end else if (SQLServer2012Flag = True) and (IsComponentSelected('DBS\SERVER')) then begin
  161.             if PageID = PageSQL2012SetupFile2 then begin
  162.                 Result := false;
  163.         // This PageSQL2014SetupFile2 is not skipped.....
  164.             end else if PageID = PageSQL2014SetupFile2 then begin
  165.                 Result := true;
  166.         // This PageSQL2008SetupFile2 and PageSQL2008R2SetupFile2 are skipped properly.....
  167.             end else if PageID = PageSQL2008SetupFile2 then begin
  168.                 Result := true;
  169.             end else if PageID = PageSQL2008R2SetupFile2 then begin
  170.                 Result := true;
  171.             end;
  172.        
  173.         end else if (SQLServer2014Flag = True) and (IsComponentSelected('DBS\SERVER')) then begin
  174.             if PageID = PageSQL2014SetupFile2 then begin
  175.                 Result := false;
  176.             end else if PageID = PageSQL2008SetupFile2 then begin
  177.                 Result := true;
  178.             end else if PageID = PageSQL2008R2SetupFile2 then begin
  179.                 Result := true;
  180.             end else if PageID = PageSQL2012SetupFile2 then begin
  181.                 Result := true;
  182.             end;
  183.         end;
  184. // some more logic
  185.  
  186. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement