diff options
author | Stef Walter <stef@thewalter.net> | 2003-09-17 19:07:23 +0000 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2003-09-17 19:07:23 +0000 |
commit | 3f95d417d9e623ac0c74df8ef11d7a01846392dd (patch) | |
tree | 45ec73f2dc07eafd7f41a6f62a8cdfbaa279469f /NSCmpts/EmptyRecycleBin.h |
Diffstat (limited to 'NSCmpts/EmptyRecycleBin.h')
-rw-r--r-- | NSCmpts/EmptyRecycleBin.h | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/NSCmpts/EmptyRecycleBin.h b/NSCmpts/EmptyRecycleBin.h new file mode 100644 index 0000000..ab8cf0d --- /dev/null +++ b/NSCmpts/EmptyRecycleBin.h @@ -0,0 +1,110 @@ +// EmptyRecycleBin.h : Declaration of the CEmptyRecycleBin + +#ifndef __EMPTYRECYCLEBIN_H_ +#define __EMPTYRECYCLEBIN_H_ + +#include "resource.h" // main symbols +#include "Shlobj.h" +#include "../Common/CmptData.h" +#include <contexthelp.h> + +HRESULT InvokeMenuCommand(IContextMenu* pcm, HMENU hMenu, UINT nMenuItem, HWND hWndParent, bool bClosePrompt = false); +HRESULT InvokeMenuId(IContextMenu* pcm, int nIDCmd, HWND hWndParent); +int GetMenuIdFromString(HMENU hMenu, string sMenuItem); +int GetMenuIdFromString(HMENU hMenu, UINT nStrID); + +DWORD WINAPI ClosePromptWindow( LPVOID pParam ); +HWND GetTopLevel(HWND hwndChild); + +#define ER_REG_RECYCLE _T("Empty Recycle Bin") +#define ER_REG_NORTON _T("Empty Norton Protected") + +///////////////////////////////////////////////////////////////////////////// +// CEmptyRecycleBin +class ATL_NO_VTABLE CEmptyRecycleBin : + public CComObjectRootEx<CComSingleThreadModel>, + public CComCoClass<CEmptyRecycleBin, &CLSID_EmptyRecycleBin>, + public ISupportErrorInfo, + public IDispatchImpl<ISecureShutdownWin, &IID_ISecureShutdownWin, &LIBID_NightSecCmpts>, + public IPropertyPageImpl<CEmptyRecycleBin>, + public CDialogImplEx, + public CContextHelp<CEmptyRecycleBin> + +{ +public: + CEmptyRecycleBin() : CDialogImplEx(IDD) + { + m_dwTitleID = IDS_TITLERecycle; + m_dwHelpFileID = IDS_NSHELPFILE; + m_dwDocStringID = IDS_DOCSTRINGRecycle; + } + ~CEmptyRecycleBin() + { ATLTRACE(_T("Destroying EmptyRecycleBin\n")); } + + +DECLARE_REGISTRY_RESOURCEID(IDR_EMPTYRECYCLEBIN) + +BEGIN_COM_MAP(CEmptyRecycleBin) + COM_INTERFACE_ENTRY(ISecureShutdownWin) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISupportErrorInfo) + COM_INTERFACE_ENTRY_IMPL(IPropertyPage) +END_COM_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); + +// Data +protected: + CPropertyBag m_Data; + + /////////////////////////////////////////////////////////////////// +// Property Sheet Stuff + +public: + + enum {IDD = IDD_EMPTYRECYCLE}; + +BEGIN_MSG_MAP(CEmptyRecycleBin) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + CHAIN_MSG_MAP(IPropertyPageImpl<CEmptyRecycleBin>) + CHAIN_MSG_MAP(CContextHelp<CEmptyRecycleBin>) +END_MSG_MAP() + +BEGIN_HELP_MAP(NS_HELP_FILE) + HELP_ID(IDC_EMPTYRECYCLE, 4020) + HELP_ID(IDC_EMPTYNORTON, 4019) +END_HELP_MAP + +// Property Sheet Messages + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + + STDMETHOD(Apply)(void) + { + ATLTRACE(_T("CEmptyRecycleBun::Apply\n")); + + HRESULT hr; + HRESULT hrRet = S_OK; + + // Save AutoFix State + hr = m_Data.WriteInt(ER_REG_RECYCLE, IsDlgButtonChecked(IDC_EMPTYRECYCLE)); + if(FAILED(hr)) hrRet = hr; + + // Save Cluster State + hr = m_Data.WriteInt(ER_REG_NORTON, IsDlgButtonChecked(IDC_EMPTYNORTON)); + if(FAILED(hr)) hrRet = hr; + + m_bDirty = FALSE; + return hrRet; + + } + +}; + +#endif //__EMPTYRECYCLEBIN_H_ |