www.pudn.com > 2007112823521925.rar > ADDRESSPAGE.CPP


// AddressPage.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "gtmpeg.h" 
#include "AddressPage.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
IMPLEMENT_DYNCREATE(CAddressPage, CPropertyPage) 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
CAddressPage::CAddressPage() : CPropertyPage(CAddressPage::IDD) 
{ 
	//{{AFX_DATA_INIT(CAddressPage) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
	m_bEnable=FALSE; 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
CAddressPage::~CAddressPage() 
{ 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
void CAddressPage::DoDataExchange(CDataExchange* pDX) 
{ 
	CPropertyPage::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CAddressPage) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
BEGIN_MESSAGE_MAP(CAddressPage, CPropertyPage) 
	//{{AFX_MSG_MAP(CAddressPage) 
	ON_BN_CLICKED(IDC_STATIC_1, OnStatic1) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
BOOL CAddressPage::OnInitDialog()  
{ 
	CPropertyPage::OnInitDialog(); 
    SetInfoTxt(); 
	Enable(m_bEnable); 
	return TRUE; 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
void CAddressPage::Enable(BOOL bEnable) 
{ 
	for(int i=0;iEnableWindow(bEnable); 
	   GetDlgItem(IDC_PAN_ADDRESS1+i)->EnableWindow(bEnable); 
	} 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
void CAddressPage::SetInfoTxt() 
{ 
	CEdit *pEdit=NULL; 
	CString sTxt; 
    CString sEntry; 
	for(int i=0;iGetProfileString("Info",sEntry); 
		pEdit=(CEdit *)GetDlgItem(IDC_PLACE_EDIT1+i); 
	    pEdit->SetWindowText(sTxt); 
        // 
		sEntry.Format("Pan%02d_Address",i+1); 
		sTxt.Format("%d",AfxGetApp()->GetProfileInt("Info",sEntry,i)); 
		pEdit=(CEdit *)GetDlgItem(IDC_PAN_ADDRESS1+i); 
	    pEdit->SetWindowText(sTxt); 
	} 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
void CAddressPage::OnOK()  
{ 
	CEdit *pEdit=NULL; 
	CString sTxt; 
    CString sEntry; 
	for(int i=0;iGetWindowText(sTxt); 
		sEntry.Format("Channel%02d_Txt",i+1); 
		AfxGetApp()->WriteProfileString("Info",sEntry,sTxt); 
        // 
		sEntry.Format("Pan%02d_Address",i+1); 
		AfxGetApp()->WriteProfileInt("Info",sEntry,GetDlgItemInt(IDC_PAN_ADDRESS1+i,NULL,FALSE)); 
	} 
	CPropertyPage::OnOK(); 
} 
///////////////////////////////////////////////////////////////////////////// 
// 
///////////////////////////////////////////////////////////////////////////// 
void CAddressPage::OnStatic1()  
{ 
   m_bEnable=!m_bEnable; 
   Enable(m_bEnable); 
}