1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
// ClearInetCache.h : Declaration of the CClearInetCache
#ifndef __CLEARINETCACHE_H_
#define __CLEARINETCACHE_H_
#include "resource.h" // main symbols
#include "../Common/CmptData.h"
#define NO_KEY _T("No Key")
#include <vector>
using std::vector;
#include <mystring.h>
typedef vector<string> StringArray;
#include <atlctrls.h>
#include <contexthelp.h>
// #include "../common/events.h"
/////////////////////////////////////////////////////////////////////////////
// CClearInetCache
class ATL_NO_VTABLE CClearInetCache :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CClearInetCache, &CLSID_ClearInetCache>,
public ISupportErrorInfo,
public IDispatchImpl<ISecureShutdownWin, &IID_ISecureShutdownWin, &LIBID_NightSecNetCmpts>,
// public IDispEventImpl<0, CClearInetCache, &DIID_DShutdownEvents, &LIBID_NightSecShutdown, 2, 5>,
public IObjectWithSiteImpl<CClearInetCache>,
// Property Page
public IPropertyPageImpl<CClearInetCache>,
public CDialogImpl<CClearInetCache>,
public CContextHelp<CClearInetCache>
{
public:
CClearInetCache()
{
m_dwTitleID = IDS_TITLEClearInetCacheProps;
m_dwHelpFileID = IDS_HELPFILEClearInetCacheProps;
m_dwDocStringID = IDS_DOCSTRINGClearInetCacheProps;
// m_bCancel = false;
m_bClearAll = true;
m_bCookies = false;
m_bInitialized = false;
m_dwIDCounter = 0;
m_nLoadedURLs = 0;
}
DECLARE_REGISTRY_RESOURCEID(IDR_CLEARINETCACHE)
BEGIN_COM_MAP(CClearInetCache)
COM_INTERFACE_ENTRY(ISecureShutdownWin)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IObjectWithSite)
COM_INTERFACE_ENTRY(IPropertyPage)
END_COM_MAP()
/*BEGIN_SINK_MAP(CClearInetCache)
SINK_ENTRY_EX(0, DIID_DShutdownEvents, 1, OnCancel)
END_SINK_MAP()*/
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
// ISecureShutdownWin
public:
STDMETHOD(get_Info)(/*[in]*/ NightSecInfo nsItem, /*[out, retval]*/ VARIANT* pvVal);
STDMETHOD(DoShutdown)(/*[in]*/ long hParent, /*[in]*/ long lMode);
STDMETHOD(SetData)(/*[in]*/ IUnknown* pUnk);
// Events
// protected:
// STDMETHOD(OnCancel)()
// { m_bCancel = true; return S_OK; };
// Helpers
protected:
bool IsDeleteableURL(const string& sURL);
int GetServersToDelete();
StringArray m_asServerURLs;
bool m_bClearAll;
bool m_bInitialized;
///////////////////////////////////////////////////////////////////
// Property Sheet Stuff
public:
enum {IDD = IDD_CLEARINETCACHE};
BEGIN_MSG_MAP(CClearInetCache)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
NOTIFY_HANDLER(IDC_SERVERURLLIST, LVN_ENDLABELEDIT, OnURLListEndLabelEdit)
NOTIFY_HANDLER(IDC_SERVERURLLIST, LVN_KEYDOWN, OnURLListKeyDown)
NOTIFY_HANDLER(IDC_SERVERURLLIST, NM_SETFOCUS, OnListSetFocus)
COMMAND_HANDLER(IDC_NEWURL, BN_CLICKED, OnNewURL)
COMMAND_HANDLER(IDC_DELETE, BN_CLICKED, OnDelete)
COMMAND_HANDLER(IDC_CLEARALLSERVERS, BN_CLICKED, OnClearAll)
CHAIN_MSG_MAP(IPropertyPageImpl<CClearInetCache>)
CHAIN_MSG_MAP(CContextHelp<CClearInetCache>)
END_MSG_MAP()
BEGIN_HELP_MAP("nightsec.hlp")
HELP_ID(IDC_SERVERURLLIST, 4016)
HELP_ID(IDC_COOKIES, 4015)
HELP_ID(IDC_CLEARALLSERVERS, 4014)
HELP_ID(IDC_NEWURL, 4018)
HELP_ID(IDC_DELETE, 4017)
END_HELP_MAP
// Property Sheet Messages
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnURLListEndLabelEdit(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
LRESULT OnURLListKeyDown(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
LRESULT OnListSetFocus(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
LRESULT OnNewURL(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnDelete(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnClearAll(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
protected:
HRESULT SaveChanges();
void UpdateClearAll();
// Data
protected:
// bool m_bCancel; // Called from Cancel Event
int m_nLoadedURLs;
void LoadFlags();
bool m_bCookies;
HICON m_hIconDel;
HICON m_hIconNew;
CPropertyBag m_Data;
CListViewCtrl m_ctlServerList;
CImageList m_ImageListSmall;
DWORD m_dwIDCounter;
public:
STDMETHOD(Apply)(void)
{
ATLTRACE(_T("CClearInetCache::Apply\n"));
HRESULT hr = SaveChanges();
m_bDirty = FAILED(hr);
return hr;
}
};
#endif //__CLEARINETCACHE_H_
|