sgProduct.doCleanupOnUpgrade = TRUE;
sgProduct.doCleanupOnUpgrade = DEFAULT_SAFE_UPGRADE;
void InitSequence(HINSTANCE hInstance){  // Wizard data structures  PROPSHEETPAGE psp;  HPROPSHEETPAGE pages[11] = {0};  PROPSHEETHEADER psh;  int count = 0;  /////////////////////////////////////////////////////////////////////////////  // Create the Wizard Sequence  //  psp.dwSize            = sizeof(psp);  psp.hInstance         = hSetupRscInst;  psp.lParam            = 0;  // Welcome Page  if (diWelcome.bShowDialog) {    psp.dwFlags           = PSP_DEFAULT|PSP_HIDEHEADER;    psp.pfnDlgProc        = DlgProcWelcome;    psp.pszTemplate       = MAKEINTRESOURCE(DLG_WELCOME);        pages[count++]        = CreatePropertySheetPage(&psp);  }  // License Page  if (diLicense.bShowDialog) {    psp.dwFlags           = PSP_DEFAULT|PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;    psp.pszHeaderTitle    = diLicense.szTitle;    psp.pszHeaderSubTitle = diLicense.szSubTitle;    psp.pfnDlgProc        = DlgProcLicense;    psp.pszTemplate       = MAKEINTRESOURCE(DLG_LICENSE);    pages[count++]        = CreatePropertySheetPage(&psp);  }  // License Page  if (diSetupType.bShowDialog) {    psp.dwFlags           = PSP_DEFAULT|PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;    psp.pszHeaderTitle    = diSetupType.szTitle;    psp.pszHeaderSubTitle = diSetupType.szSubTitle;    psp.pfnDlgProc        = DlgProcSetupType;    psp.pszTemplate       = MAKEINTRESOURCE(DLG_SETUP_TYPE);    pages[count++]        = CreatePropertySheetPage(&psp);  }  if (diSelectInstallPath.bShowDialog) {    psp.dwFlags           = PSP_DEFAULT|PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;    psp.pszHeaderTitle    = diSelectInstallPath.szTitle;    psp.pszHeaderSubTitle = diSelectInstallPath.szSubTitle;    psp.pfnDlgProc        = DlgProcSelectInstallPath;    psp.pszTemplate       = MAKEINTRESOURCE(DLG_SELECT_INSTALL_PATH);    pages[count++]        = CreatePropertySheetPage(&psp);  }  if (diUpgrade.bShowDialog) {    psp.dwFlags           = PSP_DEFAULT|PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;    psp.pszHeaderTitle    = diUpgrade.szTitle;    psp.pszHeaderSubTitle = diUpgrade.szSubTitle;    psp.pfnDlgProc        = DlgProcUpgrade;    psp.pszTemplate       = MAKEINTRESOURCE(DLG_UPGRADE);    pages[count++]        = CreatePropertySheetPage(&psp);  }  else {    // If we're not showing the Upgrade dialog, we need to set some state to    // tell the installer to default to a Safe Install.     sgProduct.doCleanupOnUpgrade = TRUE;  }  if (diSelectComponents.bShowDialog) {    psp.dwFlags           = PSP_DEFAULT|PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;    psp.pszHeaderTitle    = diSelectComponents.szTitle;    psp.pszHeaderSubTitle = diSelectComponents.szSubTitle;    psp.pfnDlgProc        = DlgProcSelectComponents;    psp.pszTemplate       = MAKEINTRESOURCE(DLG_SELECT_COMPONENTS);    pages[count++]        = CreatePropertySheetPage(&psp);  }  if (diStartInstall.bShowDialog) {    psp.dwFlags           = PSP_DEFAULT|PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;    psp.pszHeaderTitle    = diStartInstall.szTitle;    psp.pszHeaderSubTitle = diStartInstall.szSubTitle;    psp.pfnDlgProc        = DlgProcSummary;    psp.pszTemplate       = MAKEINTRESOURCE(DLG_START_INSTALL);    pages[count++]        = CreatePropertySheetPage(&psp);  }  if (diDownloading.bShowDialog) {    psp.dwFlags           = PSP_DEFAULT|PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;    psp.pszHeaderTitle    = diDownloading.szTitle;    psp.pszHeaderSubTitle = diDownloading.szSubTitle;    psp.pfnDlgProc        = DlgProcDownloading;    psp.pszTemplate       = MAKEINTRESOURCE(DLG_DOWNLOADING);    pages[count++]        = CreatePropertySheetPage(&psp);  }  if (diInstalling.bShowDialog) {    psp.dwFlags           = PSP_DEFAULT|PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;    psp.pszHeaderTitle    = diInstalling.szTitle;    psp.pszHeaderSubTitle = diInstalling.szSubTitle;    psp.pfnDlgProc        = DlgProcInstalling;    psp.pszTemplate       = MAKEINTRESOURCE(DLG_EXTRACTING);    pages[count++]        = CreatePropertySheetPage(&psp);  }#if WINTEGRATION_PAGE  // Windows Integration Page  if (diWindowsIntegration.bShowDialog) {    psp.dwFlags           = PSP_DEFAULT|PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;    psp.pszHeaderTitle    = diWindowsIntegration.szTitle;    psp.pszHeaderSubTitle = diWindowsIntegration.szSubTitle;    psp.pfnDlgProc        = DlgProcWindowsIntegration;    psp.pszTemplate       = MAKEINTRESOURCE(DLG_WINDOWS_INTEGRATION);        pages[count++]        = CreatePropertySheetPage(&psp);  }#endif  // Successful Install Page  if (diInstallSuccessful.bShowDialog) {    psp.dwFlags           = PSP_DEFAULT|PSP_HIDEHEADER;    psp.pfnDlgProc        = DlgProcInstallSuccessful;    psp.pszTemplate       = MAKEINTRESOURCE(DLG_INSTALL_SUCCESSFUL);        pages[count++]        = CreatePropertySheetPage(&psp);  }  // Property Sheet  psh.dwSize            = sizeof(psh);  psh.hInstance         = hSetupRscInst;  psh.hwndParent        = NULL;  psh.phpage            = pages;  psh.dwFlags           = PSH_WIZARD97|PSH_WATERMARK|PSH_HEADER;  psh.pszbmWatermark    = MAKEINTRESOURCE(IDB_WATERMARK);  psh.pszbmHeader       = MAKEINTRESOURCE(IDB_HEADER);  psh.nStartPage        = 0;  psh.nPages            = count;  // Create the Font for Intro/End page headers.  sgInstallGui.welcomeTitleFont = MakeFont(TEXT("Trebuchet MS Bold"), 14, FW_BOLD);  // Start the Wizard.  PropertySheet(&psh);  DeleteObject(sgInstallGui.welcomeTitleFont);}