www.pudn.com > 数字硬盘录像机软件代码.rar > FACEPAGE.CPP


// FacePage.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "gtmpeg.h" 
#include "FacePage.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
IMPLEMENT_DYNCREATE(CFacePage, CPropertyPage) 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
CFacePage::CFacePage() : CPropertyPage(CFacePage::IDD) 
{ 
	//{{AFX_DATA_INIT(CFacePage) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
CFacePage::~CFacePage() 
{ 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
void CFacePage::DoDataExchange(CDataExchange* pDX) 
{ 
	CPropertyPage::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CFacePage) 
	//}}AFX_DATA_MAP 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
BEGIN_MESSAGE_MAP(CFacePage, CPropertyPage) 
	//{{AFX_MSG_MAP(CFacePage) 
	ON_BN_CLICKED(IDC_BUTTON_CHOICE, OnButtonChoice) 
	ON_BN_CLICKED(IDC_MENU_CHOICE, OnMenuChoice) 
	ON_BN_CLICKED(IDC_MENUFRAME_CHOICE, OnMenuframeChoice) 
	ON_BN_CLICKED(IDC_SCREEN_CHOICE, OnScreenChoice) 
	ON_BN_CLICKED(IDC_VIDEO_CHOICE, OnVideoChoice) 
	ON_BN_CLICKED(IDC_VIDEOFRAME_CHOICE, OnVideoframeChoice) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
BOOL CFacePage::OnInitDialog()  
{ 
	CPropertyPage::OnInitDialog(); 
	GetDlgItem(IDC_SCREEN_BK)->SetWindowText(AfxGetApp()->GetProfileString("Face","ScreenBK")); 
	GetDlgItem(IDC_MENU_BK)->SetWindowText(AfxGetApp()->GetProfileString("Face","MenuBK")); 
	GetDlgItem(IDC_MENU_FRAME_BK)->SetWindowText(AfxGetApp()->GetProfileString("Face","MenuFrameBK")); 
	GetDlgItem(IDC_VIDEO_BK)->SetWindowText(AfxGetApp()->GetProfileString("Face","VideoBK")); 
	GetDlgItem(IDC_VIDEO_FRAME_BK)->SetWindowText(AfxGetApp()->GetProfileString("Face","VideoFrameBK")); 
	GetDlgItem(IDC_BUTTON_BK)->SetWindowText(AfxGetApp()->GetProfileString("Face","ButtonBK")); 
	return TRUE; 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
void CFacePage::OnButtonChoice()  
{ 
  SetBKFileName(IDC_BUTTON_BK); 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
void CFacePage::OnMenuChoice()  
{ 
   SetBKFileName(IDC_MENU_BK); 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
void CFacePage::OnMenuframeChoice()  
{ 
  SetBKFileName(IDC_MENU_FRAME_BK); 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
void CFacePage::OnScreenChoice()  
{ 
  SetBKFileName(IDC_SCREEN_BK); 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
void CFacePage::OnVideoChoice()  
{ 
  SetBKFileName(IDC_VIDEO_BK); 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
void CFacePage::OnVideoframeChoice()  
{ 
	SetBKFileName(IDC_VIDEO_FRAME_BK); 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
void CFacePage::SetBKFileName(int nID) 
{ 
	CString sTxt; 
	GetDlgItem(nID)->GetWindowText(sTxt); 
	const CHAR filedialogFilter[]="jpg (*.jpg)|*.jpg|位图 (*.bmp)|*.bmp|gif (*.gif)|*.gif||"; 
	CFileDialog Filedialog(TRUE,GetFileType(sTxt),sTxt,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_EXTENSIONDIFFERENT|OFN_FILEMUSTEXIST,filedialogFilter); 
	if (Filedialog.DoModal() != IDOK) 
		return; 
	else 
	{ 
	  GetDlgItem(nID)->SetWindowText(Filedialog.GetPathName()); 
	} 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
CString CFacePage::GetFileType(CString sFileName) 
{ 
    CString sType; 
	int nPos=sFileName.Find("."); 
	if(nPos==0) 
	{ 
	  sType="jpg"; 
	} 
	else 
	  sType=sFileName.Right(3); 
	return sType; 
} 
//////////////////////////////// 
// 
/////////////////////////////// 
void CFacePage::OnOK()  
{ 
	CString sTxt; 
	GetDlgItem(IDC_SCREEN_BK)->GetWindowText(sTxt); 
	AfxGetApp()->WriteProfileString("Face","ScreenBK",sTxt); 
	 
	GetDlgItem(IDC_MENU_BK)->GetWindowText(sTxt); 
	AfxGetApp()->WriteProfileString("Face","MenuBK",sTxt); 
	 
	GetDlgItem(IDC_MENU_FRAME_BK)->GetWindowText(sTxt); 
	AfxGetApp()->WriteProfileString("Face","MenuFrameBK",sTxt); 
 
	GetDlgItem(IDC_VIDEO_BK)->GetWindowText(sTxt); 
	AfxGetApp()->WriteProfileString("Face","VideoBK",sTxt); 
	 
	GetDlgItem(IDC_VIDEO_FRAME_BK)->GetWindowText(sTxt); 
	AfxGetApp()->WriteProfileString("Face","VideoFrameBK",sTxt); 
	CPropertyPage::OnOK(); 
}