www.pudn.com > FileGuard.zip > MyPropertySheet.cpp


// MyPropertySheet.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "resource.h" 
#include "MyPropertySheet.h" 
 
#include "..\HookShr\ComDef.h" 
 
#ifdef _DEBUG 
#undef THIS_FILE 
static char BASED_CODE THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CFileGuardPropertySheet 
 
IMPLEMENT_DYNAMIC(CFileGuardPropertySheet, CPropertySheet) 
 
CFileGuardPropertySheet::CFileGuardPropertySheet(CWnd* pWndParent) 
	 : CPropertySheet(IDS_PROPSHT_CAPTION, pWndParent) 
{ 
	m_psh.dwFlags |=PSH_NOAPPLYNOW; 
 
	AddPage(&m_Page1); 
	AddPage(&m_Page2); 
} 
 
CFileGuardPropertySheet::~CFileGuardPropertySheet() 
{ 
} 
 
 
BEGIN_MESSAGE_MAP(CFileGuardPropertySheet, CPropertySheet) 
	//{{AFX_MSG_MAP(CFileGuardPropertySheet) 
		// NOTE - the ClassWizard will add and remove mapping macros here. 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
 
///////////////////////////////////////////////////////////////////////////// 
// CFileGuardPropertySheet message handlers 
 
 
 
void CFileGuardPropertySheet::SetPath(LPCTSTR lpszPath) 
{ 
	m_Page1.m_strPath=lpszPath; 
} 
 
CString CFileGuardPropertySheet::GetPath() 
{ 
	return m_Page1.m_strPath; 
} 
 
WORD CFileGuardPropertySheet::GetProtectionType() 
{ 
	if( m_Page1.m_nAction!=1 )		//if "add" radio box is not selected... 
		return 0; 
 
	return (m_Page1.m_bDeleteProtection*PT_DELETE | m_Page1.m_bWriteProtection*PT_WRITE 
		| m_Page1.m_bReadProtection*PT_READ | m_Page1.m_bHideFile*PT_HIDE); 
} 
 
 
 
void CFileGuardPropertySheet::SetProtectionType(WORD type) 
{ 
	m_Page1.m_bDeleteProtection= type&PT_DELETE ? 1 : 0; 
	m_Page1.m_bWriteProtection=type&PT_WRITE ? 1 : 0; 
	m_Page1.m_bReadProtection=type&PT_READ ? 1 : 0; 
	m_Page1.m_bHideFile=type&PT_HIDE? 1 : 0; 
 
	//if(::IsWindow(m_Page1.m_hWnd))	 
	//	m_Page1.UpdateData(FALSE); 
}