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

Windows Kernel

Development Platform:

Visual C++

  1. #include "shwizard.h"
  2. #include <string.h>
  3. #include <tchar.h>
  4. #include <shlguid.h>
  5. #include <shlobj.h>
  6. #include <shlwapi.h>
  7. #include "winreg.h"
  8. TCHAR g_szBmpFileName[MAX_PATH];
  9. TCHAR g_DesktopBmpFile[MAX_PATH];
  10. TCHAR g_szPicList[MAX_PATH];
  11. INT_PTR APIENTRY PageT1Proc (HWND, UINT, WPARAM, LPARAM);
  12. void PageT1_OnInitDialog (HWND);
  13. void PageT1_OnSetActive  (HWND);
  14. void AddPictureFilesToListBox(HWND hDlg, LPCTSTR pszDir);
  15. void BrowseBmpToLst (HWND);
  16. void OnSelChangePiclist (HWND);
  17. void OnBrowse (HWND);
  18. void OnTextChangeColor (HWND);
  19. void OnBkgndChangeColor (HWND);
  20. void OnDrawItem (int, LPDRAWITEMSTRUCT);
  21. COLORREF GetButtonColor (int);
  22. void RenderTheButton (LPDRAWITEMSTRUCT, COLORREF);
  23. INT_PTR APIENTRY PageT1Proc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
  24. {
  25.     BOOL bRet = TRUE;
  26.     switch (msg)
  27.     {
  28.     case WM_COMMAND:
  29.     {
  30.         switch (HIWORD(wParam))
  31.         {
  32.         case BN_CLICKED:
  33.         {
  34.             switch (LOWORD(wParam))
  35.             {
  36.             case IDC_BROWSE:
  37.                 OnBrowse(hDlg);
  38.                 break;
  39.             case IDC_BTN_TEXT_COLOR:
  40.                 OnTextChangeColor(hDlg);
  41.                 break;
  42.             case IDC_BTN_BKGND_COLOR:
  43.                 OnBkgndChangeColor(hDlg);
  44.                 break;
  45.             default:
  46.                 bRet = FALSE;
  47.                 break;
  48.             }
  49.             break;
  50.         }
  51.         case LBN_SELCHANGE:
  52.         {
  53.             if (LOWORD(wParam) == IDC_PICLIST)
  54.             {
  55.                 OnSelChangePiclist(hDlg);
  56.             }
  57.             break;
  58.         }
  59.         default:
  60.             bRet = FALSE;
  61.             break;
  62.         }
  63.         break;
  64.     }
  65.     case WM_DRAWITEM:
  66.         OnDrawItem((UINT)wParam, (LPDRAWITEMSTRUCT)lParam);
  67.         break;
  68.     case WM_INITDIALOG:
  69.         PageT1_OnInitDialog(hDlg);
  70.         return FALSE;
  71.     case WM_DESTROY:
  72.     {
  73.         if (g_pCommonInfo->WasItCustomized() && g_pCommonInfo->WasThisOptionalPathUsed(IDD_PAGET1))
  74.         {
  75.             UpdateChangeBitmap(g_szBmpFileName);
  76.         }
  77.         break;
  78.     }
  79.     case WM_NOTIFY:
  80.     {
  81.         switch (((NMHDR FAR *)lParam)->code)
  82.         {
  83.             case PSN_QUERYCANCEL:
  84.                 bRet = FALSE;
  85.             case PSN_KILLACTIVE:
  86.             case PSN_RESET:
  87.                 Unsubclass(GetDlgItem(hDlg, IDC_EXPLORER));
  88.                 g_pCommonInfo->OnCancel(hDlg);
  89.                 break;
  90.             case PSN_SETACTIVE:
  91.                 Subclass(GetDlgItem(hDlg, IDC_EXPLORER));
  92.                 PageT1_OnSetActive(hDlg);
  93.                 break;
  94.             case PSN_WIZNEXT:
  95.                 Unsubclass(GetDlgItem(hDlg, IDC_EXPLORER));
  96.                 //ASSERT(g_pCommonInfo);
  97.                 g_pCommonInfo->OnNext(hDlg);
  98.                 break;
  99.             case PSN_WIZBACK:
  100.                 Unsubclass(GetDlgItem(hDlg, IDC_EXPLORER));
  101.                 //ASSERT(g_pCommonInfo);
  102.                 g_pCommonInfo->OnBack(hDlg);
  103.                 break;
  104.             default:
  105.                 bRet = FALSE;
  106.                 break;
  107.         }
  108.         break;
  109.     }
  110.     default:
  111.         bRet = FALSE;
  112.         break;
  113.     }
  114.     return bRet;
  115. }
  116. void GetWallpaperDirName(LPTSTR lpszWallPaperDir, int iBuffSize)
  117. {
  118.     //Compute the default wallpaper name.
  119.     GetWindowsDirectory(lpszWallPaperDir, iBuffSize);
  120.     PathAppend(lpszWallPaperDir, TEXT("Web"));
  121.     //Read it from the registry key, if it is set!
  122.     DWORD dwType;
  123.     DWORD cbData = (DWORD)iBuffSize;
  124.     SHGetValue(HKEY_LOCAL_MACHINE, TEXT("Software\Microsoft\Windows\CurrentVersion"), TEXT("WallPaperDir"), &dwType, (LPVOID)lpszWallPaperDir, &cbData);
  125.     // BUGBUG: Currently the type is wrongly being set to REG_SZ. When this is changed by setup, uncomment the if() below.
  126.     // if (dwType == REG_EXPAND_SZ)
  127.     {
  128.         TCHAR szExp[MAX_PATH];
  129.         ExpandEnvironmentStrings(lpszWallPaperDir, szExp, ARRAYSIZE(szExp));
  130.         lstrcpyn(lpszWallPaperDir, szExp, iBuffSize);
  131.     }
  132. }
  133. void PageT1_OnInitDialog (HWND hDlg)
  134. {
  135.     HWND        hWndListBox;
  136.     RECT        rect;
  137.     COLORREF    crTemp;
  138.     TCHAR       szDir[MAX_PATH], szTemp[MAX_PATH];
  139.     // Files from two different directories are listed.
  140.     // To find from which directory a particular file 
  141.     // has come,the path of the file has been appended
  142.     // at the end of the filename in the list box. Inorder
  143.     // to make only the filename visible to the user,
  144.     // it is appended after the tabstop
  145.     // Eg:  Bubbles.bmp t c:Win95Pictures
  146.     // Set tabstop to the listbox
  147.     hWndListBox = GetDlgItem(hDlg, IDC_PICLIST);
  148.     GetWindowRect(hWndListBox, &rect);
  149.     int x = rect.right - rect.left;
  150.     SendMessage(hWndListBox, LB_SETTABSTOPS, 1, (LPARAM)&x);
  151.     
  152.     // Add (None) to the ListBox
  153.     LoadString(g_hAppInst, IDS_ENTRY_NONE, szTemp, ARRAYSIZE(szTemp));
  154.     SendMessage(hWndListBox, LB_ADDSTRING, 0, (LPARAM)szTemp);
  155.     // List the required files from Windows directory
  156.     AddPictureFilesToListBox(hDlg, g_szWinDir);
  157.     GetWallpaperDirName(szDir, ARRAYSIZE(szDir));
  158.     AddPictureFilesToListBox(hDlg, szDir);
  159.     
  160.     //Get the path to the "My Pictures" folder
  161.     if (S_OK == SHGetFolderPath(NULL, CSIDL_MYPICTURES, NULL, 0, szDir))
  162.     {
  163.         // Add all pictures in "My Pictures" directory to the list!
  164.         AddPictureFilesToListBox(hDlg, szDir);
  165.     }
  166.     
  167.     if (lstrcmpi(g_szWinDir, g_szCurFolder))    // if the folder being customized is not %windir%
  168.     {
  169.         // List the required files from Current directory
  170.         AddPictureFilesToListBox(hDlg, g_szCurFolder);
  171.     }
  172.     // If a folder is already customized & a bitmap 
  173.     // background is already chosen, then bitmap listbox
  174.     // comes-up with that bitmap item already selected.
  175.     // Tile/Center buttons also reflect the previous
  176.     // selection
  177.                                                     
  178.     if (!TemplateExists(g_szIniFile))    // Desktop.ini doesn't exist
  179.     {
  180.         SendMessage(hWndListBox, LB_SETCURSEL, 0, 0);   // Selects the first file in the ListBox
  181.     }
  182.     else
  183.     {
  184.         TCHAR szGUID[GUIDSTR_MAX];
  185.         TCharStringFromGUID(VID_FolderState, szGUID);
  186.         TCHAR szString[MAX_PATH];
  187.         GetPrivateProfileString(szGUID, TEXT("IconArea_Text"),
  188.                                         TEXT("0x00000000"),
  189.                                         szString,
  190.                                         ARRAYSIZE(szString),
  191.                                         g_szIniFile);
  192.         LPSTR lpszString;
  193.         CHAR szStr[MAX_PATH];
  194. #ifdef UNICODE
  195.         WideCharToMultiByte(CP_ACP, 0, szString, -1, szStr, sizeof(szStr), 0, 0);
  196.         lpszString = szStr;
  197. #else
  198.         lpszString = szString;
  199. #endif
  200.         crTemp = (COLORREF)strtoul(lpszString, NULL, 16);
  201.         if (crTemp != ShortcutColorText.crColor)
  202.         {
  203.             ShortcutColorText.crColor = crTemp;
  204.             ShortcutColorText.iChanged = TRUE;      //FROM_INI;
  205.         }
  206.         GetPrivateProfileString(szGUID, TEXT("IconArea_TextBackground"),
  207.                                         TEXT("0xFFFFFFFF"),
  208.                                         szString,
  209.                                         ARRAYSIZE(szString),
  210.                                         g_szIniFile);
  211. #ifdef UNICODE
  212.         WideCharToMultiByte(CP_ACP, 0, szString, -1, szStr, sizeof(szStr), 0, 0);
  213.         lpszString = szStr;
  214. #else
  215.         lpszString = szString;
  216. #endif
  217.         crTemp = (COLORREF)strtoul(lpszString, NULL, 16);
  218.         if (crTemp != 0xFFFFFFFF)
  219.         {
  220.             ShortcutColorBkgnd.crColor = crTemp;
  221.             ShortcutColorBkgnd.iChanged = TRUE;     //FROM_INI;
  222.         }
  223.         else
  224.         {
  225.             ShortcutColorBkgnd.crColor = GetSysColor(COLOR_3DFACE);
  226.             ShortcutColorBkgnd.iChanged = FALSE;
  227.         }
  228.         int ret = GetPrivateProfileString(szGUID,
  229.                                           TEXT("IconArea_Image"),
  230.                                           TEXT("default"),
  231.                                           szString,
  232.                                           ARRAYSIZE(szString),
  233.                                           g_szIniFile);
  234.         if (lstrcmp(szString,TEXT("default")) != 0) {
  235.             TCHAR szTemp2[MAX_PATH + 7];
  236.             lstrcpyn(szTemp2, szString, ARRAYSIZE(szTemp2));
  237.             LPTSTR pszTemp2 = szTemp2;
  238.             if (StrCmpNI(TEXT("file://"), pszTemp2, 7) == 0) // ARRAYSIZE(TEXT("file://"))
  239.             {
  240.                 pszTemp2 += 7;   // ARRAYSIZE(TEXT("file://"))
  241.             }
  242.             // handle relative references...
  243.             PathCombine(pszTemp2, g_szCurFolder, pszTemp2);
  244.             lstrcpy(g_DesktopBmpFile, pszTemp2);
  245.             ret = GetPrivateProfileInt(szGUID,
  246.                                        TEXT("IconArea_Pos"),
  247.                                        -1,
  248.                                        g_szIniFile);
  249. //            if (ret != -1) {
  250. //                m_fPicPos = ret;
  251. //                CWnd::UpdateData(FALSE);
  252. //            }
  253.             /***********    
  254.             Get the background bitmap previously
  255.             selected. Add this to the Listbox if it is not present*/
  256.             BrowseBmpToLst(hDlg);
  257.         } else {
  258.             SendMessage(hWndListBox, LB_SETCURSEL, 0, 0);
  259.             LoadString(g_hAppInst, IDS_ENTRY_NONE, g_DesktopBmpFile, ARRAYSIZE(g_DesktopBmpFile));
  260.         }
  261.     }
  262.     // set focus to the piclist...
  263.     SetFocus(GetDlgItem(hDlg, IDC_PICLIST));
  264. }
  265. void PageT1_OnSetActive (HWND hDlg)
  266. {
  267.     // Make the preview etc. match the selection
  268.     OnSelChangePiclist(hDlg);
  269.     //ASSERT(g_pCommonInfo);
  270.     g_pCommonInfo->OnSetActive(hDlg);
  271. }   /*  end PageT1_OnSetActive() */
  272. void AddFileToListBox(HWND hDlg, LPCTSTR pszFileName, LPCTSTR pszDir)
  273. {
  274.     TCHAR szString[MAX_PATH];
  275.     lstrcpyn(szString, pszFileName, ARRAYSIZE(szString));
  276.     StrCatBuff(szString, TEXT("t"), ARRAYSIZE(szString));
  277.     StrCatBuff(szString, pszDir, ARRAYSIZE(szString));
  278.     SendMessage(GetDlgItem(hDlg, IDC_PICLIST), LB_ADDSTRING, 0, (LPARAM)szString);
  279. }
  280. /************************************************************
  281.  void AddFilesToListBox(HWND hDlg, LPCTSTR Path) Fills the listbox 
  282.  with filenames from the directory specified in the parameters
  283.  Parameters: hDlg      - The handle to the dialog
  284.              pszDir    - The directory to search in
  285.              pszFilter - The filter to FindFirstFile()
  286.  Return Value: void
  287.  ************************************************************/
  288. void AddFilesToListBox(HWND hDlg, LPCTSTR pszDir, LPCTSTR pszFilter)
  289. {
  290.     TCHAR szFilePath[MAX_PATH];
  291.     lstrcpyn(szFilePath, pszDir, ARRAYSIZE(szFilePath));
  292.     PathAppend(szFilePath, pszFilter);
  293.     
  294.     WIN32_FIND_DATA fdata;
  295.     HANDLE handle = FindFirstFile(szFilePath, &fdata);
  296.     if (handle != INVALID_HANDLE_VALUE)
  297.     {
  298.         do
  299.         {
  300.             AddFileToListBox(hDlg, fdata.cFileName, pszDir);
  301.         } while (FindNextFile(handle, &fdata));
  302.         FindClose(handle);
  303.    }
  304. }
  305. static const LPCTSTR c_rgpszBackgroundFileExt[] =
  306. {
  307.     TEXT("*.BMP"), TEXT("*.JPG"),
  308.     TEXT("*.GIF"), TEXT("*.TIF"),
  309.     TEXT("*.PNG"), TEXT("*.DIB")
  310. };
  311. void AddPictureFilesToListBox(HWND hDlg, LPCTSTR pszDir)
  312. {
  313.     for (int i = 0; i < ARRAYSIZE(c_rgpszBackgroundFileExt); i++)
  314.     {
  315.         AddFilesToListBox(hDlg, pszDir, c_rgpszBackgroundFileExt[i]);
  316.     }
  317. }
  318. /********************************************************
  319. void BrowseBmpToLst(): Add the Back ground bitmap file name 
  320.                        into the listbox if it does not exist
  321. /********************************************************/
  322. void BrowseBmpToLst (HWND hDlg)
  323. {
  324.     INT_PTR iCount, x;
  325.     TCHAR *left, *right, szTemp[MAX_PATH] = {0};
  326.     HWND hLbx = GetDlgItem(hDlg, IDC_PICLIST);
  327.     
  328.     left = g_DesktopBmpFile;
  329.     right = PathFindFileName(g_DesktopBmpFile);
  330.     lstrcpy(szTemp, right);
  331.     lstrcat(szTemp, TEXT("t"));
  332.     _tcsncat(szTemp, left, (int)(right - left));
  333.     lstrcpy(g_DesktopBmpFile, szTemp);
  334.     iCount = SendMessage(hLbx, LB_GETCOUNT, 0, 0);
  335.     for (x = 0; x < iCount; x++) {
  336.         SendMessage(hLbx, LB_GETTEXT, x, (LPARAM)szTemp);
  337.         if (lstrcmpi(g_DesktopBmpFile, szTemp) == 0) {
  338.             SendMessage(hLbx, LB_SETCURSEL, x, 0);
  339.             break;
  340.         }
  341.     }
  342.     if (x >= iCount) {
  343.         x = SendMessage(hLbx, LB_ADDSTRING, 0, (LPARAM)g_DesktopBmpFile);
  344.         SendMessage(hLbx, LB_SETCURSEL, x, 0);
  345.     }
  346. }   /*  end BrowseBmpToLst() */
  347. /************************************************************
  348.  void OnSelchangePiclist(): As the selection in the 
  349.  List box changes. Display picture() is called to display the
  350.  selected file in the control.
  351.  Parameters: None
  352.  Return Value: void
  353.  ************************************************************/
  354. void OnSelChangePiclist (HWND hDlg)
  355. {
  356.     // Gets the selected string in the listbox.
  357.     HWND hLbx = GetDlgItem(hDlg, IDC_PICLIST);
  358.     INT_PTR index = SendMessage(hLbx, LB_GETCURSEL, 0, 0);
  359.     SendMessage(hLbx, LB_GETTEXT, (WPARAM)index, (LPARAM)g_szPicList);
  360.     // Rearranges the string to get the correct File name of the file to be displayed
  361.     TCHAR szTemp[MAX_PATH];
  362.     LoadString(g_hAppInst, IDS_ENTRY_NONE, szTemp, ARRAYSIZE(szTemp));
  363.     if (lstrcmp(g_szPicList, szTemp) != 0)
  364.     {
  365.         TCHAR szTemp2[MAX_PATH];
  366.         lstrcpyn(szTemp2, g_szPicList, ARRAYSIZE(szTemp2));
  367.         // szTemp2 is now of the form - filenametdirpath
  368.         LPTSTR pszDir = StrChr(szTemp2, TEXT('t'));
  369.         // pszDir now points to - tdirpath
  370.         lstrcpyn(szTemp, pszDir + 1, ARRAYSIZE(szTemp));
  371.         *pszDir = TEXT('');
  372.         // szTemp2 is now filename
  373.         PathAppend(szTemp, szTemp2);
  374.         lstrcpy(g_szBmpFileName, szTemp);
  375.         DisplayBackground(g_szBmpFileName, GetDlgItem(hDlg, IDC_EXPLORER));
  376.     }
  377.     else
  378.     {
  379.         lstrcpy(g_szBmpFileName, g_szPicList);
  380.         DisplayNone(GetDlgItem(hDlg, IDC_EXPLORER));
  381.     }
  382. }
  383. const TCHAR c_szFilter[] = TEXT("*.bmp;*.jpg;*.gif;*.tif;*.dib");
  384. /************************************************************
  385.  void OnBrowse(): This brings up the Standard File 
  386.  Open dialog. Inorder to persist its previous location, the
  387.  location is stored in the registry.
  388.  Parameters: None
  389.  Return Value: void
  390.  ************************************************************/
  391. void OnBrowse (HWND hDlg)
  392. {
  393.     // The filter is of the form DisplayStringFilterString
  394.     TCHAR szFilter[MAX_PATH];
  395.     int cch = LoadString(g_hAppInst, IDS_BACKGROUND_FILES, szFilter, ARRAYSIZE(szFilter));
  396.     lstrcpyn(szFilter + cch + 1, c_szFilter, ARRAYSIZE(szFilter) - cch - 1);
  397.     szFilter[cch + 1 + ARRAYSIZE(c_szFilter)] = TEXT('');
  398.     
  399.     HKEY hkey;
  400.     TCHAR szTemp[MAX_PATH];
  401.     OPENFILENAME ofn = {0};
  402.     DWORD dwType = REG_SZ, dwSize = SIZEOF(szTemp);
  403.     BOOL bGotHKey = FALSE;
  404.     szTemp[0] = TEXT('');
  405.     //Queries the registry to get the previous location
  406.     if (RegOpenKeyEx(HKEY_CURRENT_USER, REG_FC_WIZARD, 0, KEY_READ | KEY_WRITE, &hkey) != ERROR_SUCCESS)
  407.     {
  408.         bGotHKey = TRUE;
  409.         if (RegQueryValueEx(hkey, REG_VAL_PERSISTEDBACKGROUNDFILENAME, 0, &dwType, (LPBYTE)szTemp, &dwSize) != ERROR_SUCCESS)
  410.         {
  411.             szTemp[0] = TEXT('');
  412.         }
  413.     }
  414.     ofn.lStructSize = sizeof(ofn);
  415.     ofn.hwndOwner = hDlg;
  416.     ofn.lpstrFilter = szFilter;
  417.     ofn.lpstrFile = szTemp;
  418.     ofn.nMaxFile = ARRAYSIZE(szTemp);
  419.     ofn.Flags = OFN_FILEMUSTEXIST;
  420.     ofn.lpstrDefExt = TEXT("bmp");
  421.     // Brings up the File open dialog with location from the registry
  422.     // Displays the file selected & update the registry with the current file name
  423.     if (GetOpenFileName(&ofn))
  424.     {
  425.         lstrcpy(g_DesktopBmpFile, ofn.lpstrFile);
  426.         BrowseBmpToLst(hDlg);
  427.         OnSelChangePiclist(hDlg);
  428.         if (bGotHKey)
  429.         {
  430.             RegSetValueEx(hkey, REG_VAL_PERSISTEDBACKGROUNDFILENAME, 0, REG_SZ, (LPBYTE)ofn.lpstrFile, (lstrlen(ofn.lpstrFile) + 1) * SIZEOF(*ofn.lpstrFile));
  431.         }
  432.     }   
  433.     if (bGotHKey)
  434.     {
  435.         RegCloseKey(hkey);
  436.     }
  437. }
  438. // Refresh the preview and stuff
  439. void OnTextChangeColor (HWND hDlg)
  440. {
  441.     ChooseShortcutColor(hDlg, &ShortcutColorText);
  442.     OnSelChangePiclist (hDlg);
  443. }   /*  end OnTextChangeColor() */
  444. // Refresh the preview and stuff
  445. void OnBkgndChangeColor (HWND hDlg)
  446. {
  447.     ChooseShortcutColor(hDlg, &ShortcutColorBkgnd);
  448.     OnSelChangePiclist (hDlg);
  449. }   /*  end OnBkgndChangeColor() */
  450. void OnDrawItem (int iCtlID, LPDRAWITEMSTRUCT lpDIS)
  451. {
  452.     RenderTheButton(lpDIS, GetButtonColor(lpDIS->CtlID));
  453. }   /*  end CShPageT1::OnDrawItem() */
  454. COLORREF GetButtonColor (int iCtlID)
  455. {
  456.     if (iCtlID == IDC_BTN_TEXT_COLOR)
  457.         return(ShortcutColorText.crColor);
  458.     else
  459.         return(ShortcutColorBkgnd.crColor);
  460. }   /*  end GetButtonColor() */
  461. void RenderTheButton (LPDRAWITEMSTRUCT lpDIS, COLORREF crColor)
  462. {
  463.     HBRUSH  hMyBrush;
  464.     SIZE    thin;
  465.     
  466.     thin.cx = GetSystemMetrics(SM_CXBORDER);
  467.     thin.cy = GetSystemMetrics(SM_CYBORDER);
  468.     thin.cx = (!thin.cx) ? 1: thin.cx;
  469.     thin.cy = (!thin.cy) ? 1: thin.cy;
  470.     if (lpDIS->itemState & ODS_SELECTED) {
  471.         DrawEdge(lpDIS->hDC, &lpDIS->rcItem, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
  472.         OffsetRect(&lpDIS->rcItem, 1, 1);
  473.     } else
  474.         DrawEdge(lpDIS->hDC, &lpDIS->rcItem, EDGE_RAISED, BF_RECT | BF_ADJUST);
  475.     FillRect(lpDIS->hDC, &lpDIS->rcItem, GetSysColorBrush(COLOR_3DFACE));
  476.         
  477.     if (((lpDIS->itemState & ODS_FOCUS) && !(lpDIS->itemState & ODS_DISABLED))) {
  478.         InflateRect(&lpDIS->rcItem, -thin.cx, -thin.cy);
  479.         DrawFocusRect(lpDIS->hDC, &lpDIS->rcItem);
  480.         InflateRect(&lpDIS->rcItem, thin.cx, thin.cy);
  481.     }
  482.     if (!(lpDIS->itemState & ODS_DISABLED)) {
  483.         InflateRect(&lpDIS->rcItem, (-2 * thin.cx), (-2 * thin.cy));
  484.         FrameRect(lpDIS->hDC, &lpDIS->rcItem, GetSysColorBrush(COLOR_3DFACE));
  485.         InflateRect(&lpDIS->rcItem, -thin.cx, -thin.cy);
  486.         FillRect(lpDIS->hDC, &lpDIS->rcItem, (hMyBrush = CreateSolidBrush(crColor)));
  487.         DeleteObject(hMyBrush);
  488.     }
  489. }   /*  end RenderTheButton() */