Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Code]
- var
- PageSQL2008SetupFile2: Integer;
- PageSQL2008R2SetupFile2: Integer;
- PageSQL2012SetupFile2: Integer;
- PageSQL2014SetupFile2: Integer;
- procedure InitializeWizard();
- begin
- MyModeTypical := false;
- PageProductName := CreateInputQueryPage(wpSelectComponents,
- 'Settings',
- 'Product Name',
- 'Please specify the product name, then click Next.');
- PageProductName.Add('Product Name:', False);
- PageProductName.Values[0] := ProductName;
- //SQL Server selection page
- PageSQLServerSelection := CreateInputOptionPage(PageProductName.ID,
- 'SQL Server Selection', 'Please select the version of SQL Server you want to install.',
- '',
- True, False);
- PageSQLServerSelection.Add('SQL 2008');
- PageSQLServerSelection.Add('SQL 2008R2');
- PageSQLServerSelection.Add('SQL 2012');
- PageSQLServerSelection.Add('SQL 2014');
- PageSQLServerSelection.Values[0] := False;
- PageSQLServerSelection.Values[1] := False;
- PageSQLServerSelection.Values[2] := False;
- PageSQLServerSelection.Values[3] := False;
- // Creating Setup pages for the 4 servers
- PageSQL2008SetupFile2 := MSSQL2008SETUPDIR_CreatePage(PageSQLServerSelection.ID);
- PageSQL2008R2SetupFile2 := MSSQL2008R2SETUPDIR_CreatePage(PageSQL2008SetupFile2);
- PageSQL2012SetupFile2 := MSSQL2012SETUPDIR_CreatePage(PageSQL2008R2SetupFile2);
- PageSQL2014SetupFile2 := MSSQL2014SETUPDIR_CreatePage(PageSQL2012SetupFile2);
- // some more logic...
- end;
- // Function for creating the Setup pages for 4 SQL Servers (Same logic for all 4 servers)
- function MSSQL2008SETUPDIR_CreatePage(PreviousPageId: Integer): Integer;
- var
- Page: TWizardPage;
- BMPFile: String;
- begin
- SelectedSQLServerVersion := GetSQLServerVersion('');
- Page := CreateCustomPage(
- PreviousPageId,
- ExpandConstant('Database Settings'),
- ExpandConstant('Special note for the Microsoft SQL Server 2008 Setup')
- );
- BMPFile:= ExpandConstant('{tmp}\caution.bmp');
- if not FileExists(BMPFile) then ExtractTemporaryFile(ExtractFileName(BMPFile));
- { BitmapImage1 }
- BitmapImage1 := TBitmapImage.Create(Page);
- with BitmapImage1 do
- begin
- Bitmap.LoadFromFile(BMPFile);
- Parent := Page.Surface;
- Left := ScaleX(8);
- Top := ScaleY(8);
- Width := ScaleX(97);
- Height := ScaleY(209);
- end;
- { NewStaticText1 }
- NewStaticText1 := TNewStaticText.Create(Page);
- with NewStaticText1 do
- begin
- Parent := Page.Surface;
- 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.';
- Left := ScaleX(112);
- Top := ScaleY(8);
- Width := ScaleX(292);
- Height := ScaleY(77);
- AutoSize := False;
- TabOrder := 0;
- WordWrap := True;
- end;
- { NewStaticText2 }
- NewStaticText2 := TNewStaticText.Create(Page);
- with NewStaticText2 do
- begin
- Parent := Page.Surface;
- Caption :=
- 'CAUTION: When autorun is activated, dont click in the autorun menu of Microsoft SQL Server 2008.' + #13 +
- 'Otherwise you must reboot your machine and restart the setup !';
- Left := ScaleX(112);
- Top := ScaleY(88);
- Width := ScaleX(293);
- Height := ScaleY(62);
- AutoSize := False;
- Font.Color := -16777208;
- Font.Height := ScaleY(-11);
- Font.Name := 'Tahoma';
- Font.Style := [fsBold];
- ParentFont := False;
- TabOrder := 1;
- WordWrap := True;
- end;
- with Page do
- begin
- //OnActivate := @MSSQLSETUPDIR_Activate;
- //OnShouldSkipPage := @MSSQLSETUPDIR_ShouldSkipPage;
- //OnBackButtonClick := @MSSQLSETUPDIR_BackButtonClick;
- //OnNextButtonClick := @MSSQLSETUPDIR_NextButtonClick;
- //OnCancelButtonClick := @MSSQLSETUPDIR_CancelButtonClick;
- end;
- Result := Page.ID;
- end;
- function ShouldSkipPage(PageID: Integer): Boolean;
- var
- begin
- if PageID = wpSelectComponents then begin
- Result := MyModeTypical;
- end else if PageID = PageProductName.ID then begin
- Result := MyModeTypical;
- end;
- Log('Server is...' + SelectedSQLServerVersion);
- if SelectedSQLServerVersion <> '' then begin
- // Database Settings Warning
- if (SQLServer2008Flag = True) and (IsComponentSelected('DBS\SERVER')) then begin
- if PageID = PageSQL2008SetupFile2 then begin
- Result := false;
- end else if PageID = PageSQL2008R2SetupFile2 then begin
- Result := true;
- end else if PageID = PageSQL2012SetupFile2 then begin
- Result := true;
- end else if PageID = PageSQL2014SetupFile2 then begin
- Result := true;
- end;
- end else if (SQLServer2008R2Flag = True) and (IsComponentSelected('DBS\SERVER')) then begin
- if PageID = PageSQL2008R2SetupFile2 then begin
- Result := false;
- end else if PageID = PageSQL2012SetupFile2 then begin
- Result := true;
- end else if PageID = PageSQL2014SetupFile2 then begin
- Result := true;
- end else if PageID = PageSQL2008SetupFile2 then begin
- Result := true;
- end;
- end else if (SQLServer2012Flag = True) and (IsComponentSelected('DBS\SERVER')) then begin
- if PageID = PageSQL2012SetupFile2 then begin
- Result := false;
- // This PageSQL2014SetupFile2 is not skipped.....
- end else if PageID = PageSQL2014SetupFile2 then begin
- Result := true;
- // This PageSQL2008SetupFile2 and PageSQL2008R2SetupFile2 are skipped properly.....
- end else if PageID = PageSQL2008SetupFile2 then begin
- Result := true;
- end else if PageID = PageSQL2008R2SetupFile2 then begin
- Result := true;
- end;
- end else if (SQLServer2014Flag = True) and (IsComponentSelected('DBS\SERVER')) then begin
- if PageID = PageSQL2014SetupFile2 then begin
- Result := false;
- end else if PageID = PageSQL2008SetupFile2 then begin
- Result := true;
- end else if PageID = PageSQL2008R2SetupFile2 then begin
- Result := true;
- end else if PageID = PageSQL2012SetupFile2 then begin
- Result := true;
- end;
- end;
- // some more logic
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement