ie4.c
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 6k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. /*
  2.  * ie4 - IE4 settings
  3.  */
  4. #include "tweakui.h"
  5. #pragma message("Add help for IE4!")
  6. #pragma BEGIN_CONST_DATA
  7. const static DWORD CODESEG rgdwHelp[] = {
  8.         IDC_SETTINGSGROUP,      IDH_GROUP,
  9.         IDC_LISTVIEW,           IDH_IE4LV,
  10.         0,                      0,
  11. };
  12. #pragma END_CONST_DATA
  13. /*****************************************************************************
  14.  *
  15.  *  IE4_GetRest
  16.  *
  17.  *      Read a restriction.  The first character of the restriction is
  18.  *      `+' if it is positive sense.  All restrictions default to 0.
  19.  *
  20.  *      Always returns exactly 0 or 1.
  21.  *
  22.  *****************************************************************************/
  23. BOOL PASCAL
  24. IE4_GetRest(LPARAM lParam, LPVOID pvRef)
  25. {
  26.     LPCTSTR ptszRest = (LPCTSTR)lParam;
  27.     if (ptszRest[0] == TEXT('+')) {
  28.         return !GetRestriction(ptszRest+1);
  29.     } else {
  30.         return GetRestriction(ptszRest);
  31.     }
  32. }
  33. /*****************************************************************************
  34.  *
  35.  *  IE4_SetSmooth
  36.  *
  37.  *      Set the new restriction setting.
  38.  *
  39.  *      The first character of the restriction is
  40.  *      `+' if it is positive sense.
  41.  *
  42.  *****************************************************************************/
  43. void PASCAL
  44. IE4_SetRest(BOOL f, LPARAM lParam, LPVOID pvRef)
  45. {
  46.     LPCTSTR ptszRest = (LPCTSTR)lParam;
  47.     PBOOL pf = pvRef;
  48.     if (pf) {
  49.         *pf = (BOOL)ptszRest;
  50.     }
  51.     if (ptszRest[0] == TEXT('+')) {
  52.         f = !f;
  53.         ptszRest++;
  54.     }
  55.     SetRestriction(ptszRest, f);
  56. }
  57. /*
  58.  *  Note that this needs to be in sync with the IDS_IE4 strings.
  59.  */
  60. CHECKLISTITEM c_rgcliIE4[] = {
  61.     { IE4_GetRest,  IE4_SetRest,    (LPARAM)c_tszNoInternetIcon,        },
  62.     { IE4_GetRest,  IE4_SetRest,    (LPARAM)c_tszNoRecentDocsHistory,   },
  63.     { IE4_GetRest,  IE4_SetRest,    (LPARAM)c_tszNoRecentDocsMenu,      },
  64.     { IE4_GetRest,  IE4_SetRest,    (LPARAM)c_tszNoActiveDesktop,       },
  65.     { IE4_GetRest,  IE4_SetRest,    (LPARAM)c_tszNoActiveDesktopChanges,},
  66.     { IE4_GetRest,  IE4_SetRest,    (LPARAM)c_tszNoFavoritesMenu,       },
  67.     { IE4_GetRest,  IE4_SetRest,    (LPARAM)c_tszClearRecentDocsOnExit, },
  68. };
  69. /*****************************************************************************
  70.  *
  71.  *  IE4_OnWhatsThis
  72.  *
  73.  *****************************************************************************/
  74. void PASCAL
  75. IE4_OnWhatsThis(HWND hwnd, int iItem)
  76. {
  77.     LV_ITEM lvi;
  78.     Misc_LV_GetItemInfo(hwnd, &lvi, iItem, LVIF_PARAM);
  79.     WinHelp(hwnd, c_tszMyHelp, HELP_CONTEXTPOPUP,
  80.             IDH_SHOWINTERNET + lvi.lParam);
  81. }
  82. /*****************************************************************************
  83.  *
  84.  *  IE4_OnCommand
  85.  *
  86.  *      Ooh, we got a command.
  87.  *
  88.  *****************************************************************************/
  89. BOOL PASCAL
  90. IE4_OnCommand(HWND hdlg, int id, UINT codeNotify)
  91. {
  92.     switch (id) {
  93.     }
  94.     return 0;
  95. }
  96. /*****************************************************************************
  97.  *
  98.  *  IE4_OnInitDialog
  99.  *
  100.  *  Initialize the listview with the current restrictions.
  101.  *
  102.  *****************************************************************************/
  103. BOOL PASCAL
  104. IE4_OnInitDialog(HWND hwnd)
  105. {
  106. #if 0
  107.     HWND hdlg = GetParent(hwnd);
  108.     TCHAR tsz[MAX_PATH];
  109.     int dids;
  110.     for (dids = 0; dids < cA(c_rgrest); dids++) {
  111.         BOOL fState;
  112.         LoadString(hinstCur, IDS_IE4+dids, tsz, cA(tsz));
  113.         fState = GetRestriction(c_rgrest[dids].ptsz);
  114.         LV_AddItem(hwnd, dids, tsz, -1, fState);
  115.     }
  116. #endif
  117.     Checklist_OnInitDialog(hwnd, c_rgcliIE4, cA(c_rgcliIE4), IDS_IE4, 0);
  118.     return 1;
  119. }
  120. /*****************************************************************************
  121.  *
  122.  *  IE4_OnApply
  123.  *
  124.  *****************************************************************************/
  125. void PASCAL
  126. IE4_OnApply(HWND hdlg)
  127. {
  128.     BOOL fChanged = FALSE;
  129.     Checklist_OnApply(hdlg, c_rgcliIE4, &fChanged);
  130.     if (fChanged) {
  131.         PIDL pidl;
  132.         /*
  133.          *  Tell the shell that we changed the policies.
  134.          */
  135.         SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
  136.                     (LPARAM)c_tszIE4RegKeyChange);
  137.         /*
  138.          *  Tickle the Start Menu folder to force the Start Menu
  139.          *  to rebuild with the new policies in effect.
  140.          */
  141.         if (SUCCEEDED(SHGetSpecialFolderLocation(hdlg,
  142.                                                  CSIDL_STARTMENU, &pidl))) {
  143.             SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_IDLIST, pidl, 0);
  144.             Ole_Free(pidl);
  145.         }
  146.     }
  147. }
  148. /*****************************************************************************
  149.  *
  150.  *  Oh yeah, we need this too.
  151.  *
  152.  *****************************************************************************/
  153. #pragma BEGIN_CONST_DATA
  154. LVV lvvIE4 = {
  155.     IE4_OnCommand,
  156.     0,                          /* IE4_OnInitContextMenu */
  157.     0,                          /* IE4_Dirtify */
  158.     0,                          /* IE4_GetIcon */
  159.     IE4_OnInitDialog,
  160.     IE4_OnApply,
  161.     0,                          /* IE4_OnDestroy */
  162.     0,                          /* IE4_OnSelChange */
  163.     6,                          /* iMenu */
  164.     rgdwHelp,
  165.     0,                          /* Double-click action */
  166.     lvvflCanCheck,              /* We need check boxes */
  167.     {
  168.         { IDC_WHATSTHIS,        IE4_OnWhatsThis },
  169.         { 0,                    0 },
  170.     },
  171. };
  172. #pragma END_CONST_DATA
  173. /*****************************************************************************
  174.  *
  175.  *  Our window procedure.
  176.  *
  177.  *****************************************************************************/
  178. BOOL EXPORT
  179. IE4_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam)
  180. {
  181.     return LV_DlgProc(&lvvIE4, hdlg, wm, wParam, lParam);
  182. }