// RunScanDisk.cpp : Implementation of CRunScanDisk #include "stdafx.h" #include "NSCmpts.h" #include "RunScanDisk.h" #include "../Common/Defines.h" #include ///////////////////////////////////////////////////////////////////////////// // CRunScanDisk STDMETHODIMP CRunScanDisk::InterfaceSupportsErrorInfo(REFIID riid) { static const IID* arr[] = { &IID_ISecureShutdownDOS, }; for (int i=0;i= 0x80000000); // Format and return string with options string sParamNoSave; string sParamAutoFix; if(m_Data.GetInt(_T("Auto Fix"), true)) { sParamAutoFix.load_string(IDS_SCANDISK_AUTOFIX); sParamNoSave.load_string(IDS_SCANDISK_NOSAVE); if(!m_Data.GetInt(_T("Save Clusters"), false)) sParamNoSave = _T(""); } string sRetVal; sRetVal.format(IDS_SCANDISK_BATCHTEXT, (LPCTSTR)sParamAutoFix, (LPCTSTR)sParamNoSave); CComBSTR bsRet(sRetVal); *psText = bsRet.Detach(); return S_OK; } //////////////////////////////////////////////////////// // Returns Info about our object STDMETHODIMP CRunScanDisk::get_Info(NightSecInfo nsItem, VARIANT* pvVal) { ::VariantClear(pvVal); CComBSTR bsRetVal; switch(nsItem) { case nsName: pvVal->vt = VT_BSTR; bsRetVal.LoadString(IDS_SCANDISK_NAME); pvVal->bstrVal = bsRetVal.Detach(); return S_OK; case nsHelpText: pvVal->vt = VT_BSTR; bsRetVal.LoadString(IDS_SCANDISK_DESC); pvVal->bstrVal = bsRetVal.Detach(); return S_OK; } ::VariantClear(pvVal); return S_FALSE; } //////////////////////////////////////////////////////// // Called to initialize our data object STDMETHODIMP CRunScanDisk::SetData(IUnknown* pUnk) { return m_Data.Initialize(pUnk); } /////////////////////////////////////////////////////////////////////////////// // Property Page Stuff // Updates all controls bool CRunScanDisk::UpdateAutoFix() { bool bEnable = IsDlgButtonChecked(IDC_AUTOFIX) ? true : false; ::EnableWindow(GetDlgItem(IDC_SAVE), bEnable); ::EnableWindow(GetDlgItem(IDC_NOSAVE), bEnable); return bEnable; } LRESULT CRunScanDisk::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { // Load Auto Fix State CheckDlgButton(IDC_AUTOFIX, m_Data.GetInt(_T("Auto Fix"), true)); // Load Save Clusters State bool bSave = m_Data.GetInt(_T("Save Clusters"), false) ? true : false; CheckDlgButton(IDC_SAVE, bSave); CheckDlgButton(IDC_NOSAVE, !bSave); UpdateAutoFix(); return FALSE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } // Used to enable/disable controls LRESULT CRunScanDisk::OnAutoFix(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { UpdateAutoFix(); SetDirty(true); return 0; }