finishr.cpp
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 4k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. #include "shwizard.h"
  2. #include <shlwapi.h>
  3. void CCTFWiz_FinishUnCustomization::OnInit()
  4. {
  5.     HFONT hTitleFont = _pCommonInfo->GetTitleFont();
  6.     //ASSERT(hTitleFont);
  7.     // It's an intro page, so set the title font
  8.     SetWindowFont(GetDlgItem(_hwndDlg, IDC_TITLE_WELCOME), hTitleFont, TRUE);
  9. }
  10. void CCTFWiz_FinishUnCustomization::OnSetActive()
  11. {
  12.     // First, the the common OnSetActive().
  13.     _pCommonInfo->OnSetActive(_hwndDlg);
  14.     // Set the appropriate text message in the dialog
  15.     TCHAR szFinalDisplay[MAX_PATH*2], szTemp[MAX_PATH];
  16.     szFinalDisplay[0] = TEXT('');
  17.     if (_pCommonInfo->WasThisFeatureUnCustomized(IDC_RESTORE_HTML))
  18.     {
  19.         LoadString(g_hAppInst, IDS_RESTORE_HTML, szTemp, ARRAYSIZE(szTemp));
  20.         StrCatBuff(szFinalDisplay, szTemp, ARRAYSIZE(szFinalDisplay));
  21.         StrCatBuff(szFinalDisplay, TEXT("n"), ARRAYSIZE(szFinalDisplay));
  22.     }
  23.     if (_pCommonInfo->WasThisFeatureUnCustomized(IDC_REMOVE_BACKGROUND))
  24.     {
  25.         LoadString(g_hAppInst, IDS_REMOVE_BACKGROUND, szTemp, ARRAYSIZE(szTemp));
  26.         StrCatBuff(szFinalDisplay, szTemp, ARRAYSIZE(szFinalDisplay));
  27.         StrCatBuff(szFinalDisplay, TEXT("n"), ARRAYSIZE(szFinalDisplay));
  28.     }
  29.     if (_pCommonInfo->WasThisFeatureUnCustomized(IDC_RESTORE_ICONTEXT))
  30.     {
  31.         LoadString(g_hAppInst, IDS_RESTORE_ICONTEXTCOLOR, szTemp, ARRAYSIZE(szTemp));
  32.         StrCatBuff(szFinalDisplay, szTemp, ARRAYSIZE(szFinalDisplay));
  33.         StrCatBuff(szFinalDisplay, TEXT("n"), ARRAYSIZE(szFinalDisplay));
  34.     }
  35.     if (_pCommonInfo->WasThisFeatureUnCustomized(IDC_REMOVE_COMMENT))
  36.     {
  37.         LoadString(g_hAppInst, IDS_REMOVE_COMMENT, szTemp, ARRAYSIZE(szTemp));
  38.         StrCatBuff(szFinalDisplay, szTemp, ARRAYSIZE(szFinalDisplay));
  39.         StrCatBuff(szFinalDisplay, TEXT("n"), ARRAYSIZE(szFinalDisplay));
  40.     }
  41.     // Display the string
  42.     SetWindowText(GetDlgItem(_hwndDlg, IDC_FINISHT), szFinalDisplay);
  43. }
  44. INT_PTR APIENTRY CCTFWiz_FinishUnCustomization::WndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
  45. {
  46.     BOOL bRet = TRUE;
  47.     CCTFWiz_FinishUnCustomization* pFinishUnCustomization = NULL;
  48.     pFinishUnCustomization = (CCTFWiz_FinishUnCustomization*)GetWindowPtr(hwndDlg, GWLP_USERDATA);
  49.     //ASSERT(pFinishUnCustomization);
  50.     //ASSERT(pFinishUnCustomization->_hwndDlg == hwndDlg);
  51.     switch (msg)
  52.     {
  53.     case WM_INITDIALOG:
  54.     {
  55.         CCTF_CommonInfo* pCommonInfo = (CCTF_CommonInfo*)((LPPROPSHEETPAGE)lParam)->lParam;
  56.         //ASSERT(pCommonInfo);
  57.         pFinishUnCustomization = new CCTFWiz_FinishUnCustomization(hwndDlg, pCommonInfo);
  58.         if (pFinishUnCustomization)
  59.         {
  60.             SetWindowPtr(hwndDlg, GWLP_USERDATA, pFinishUnCustomization);
  61.             pFinishUnCustomization->OnInit();
  62.         }
  63.         else
  64.         {
  65.             bRet = FALSE ;
  66.         }
  67.         break;
  68.     }
  69.     case WM_DESTROY:
  70.     {
  71.         SetWindowPtr(hwndDlg, GWLP_USERDATA, NULL);
  72.         delete pFinishUnCustomization;
  73.         break;
  74.     }
  75.     
  76.     case WM_NOTIFY:
  77.     {
  78.         switch (((NMHDR FAR *)lParam)->code)
  79.         {
  80.         case PSN_QUERYCANCEL:
  81.             bRet = FALSE;
  82.         case PSN_KILLACTIVE:
  83.         case PSN_RESET:
  84.             pFinishUnCustomization->_pCommonInfo->OnCancel(hwndDlg);
  85.             bRet = FALSE;   // must do this to allow cancel to complete
  86.             break;
  87.         case PSN_SETACTIVE:
  88.             pFinishUnCustomization->OnSetActive();
  89.             break;
  90.         case PSN_WIZBACK:
  91.             pFinishUnCustomization->_pCommonInfo->OnBack(hwndDlg);
  92.             break;
  93.         case PSN_WIZFINISH:
  94.             pFinishUnCustomization->_pCommonInfo->OnFinishUnCustomization(hwndDlg);
  95.             break;
  96.         default:
  97.             bRet = FALSE ;
  98.             break;
  99.         }
  100.         break;
  101.     }
  102.     default:
  103.         bRet = FALSE ;
  104.         break;
  105.     }
  106.     return bRet;   
  107. }