www.pudn.com > 200518174534292.rar > PPageComm.cpp


// PPageComm.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "ParkSys.h" 
#include "PPageComm.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CPPageComm property page 
 
IMPLEMENT_DYNCREATE(CPPageComm, CPropertyPage) 
 
CPPageComm::CPPageComm() : CPropertyPage(CPPageComm::IDD) 
{ 
	//{{AFX_DATA_INIT(CPPageComm) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
CPPageComm::~CPPageComm() 
{ 
} 
 
void CPPageComm::DoDataExchange(CDataExchange* pDX) 
{ 
	CPropertyPage::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CPPageComm) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CPPageComm, CPropertyPage) 
	//{{AFX_MSG_MAP(CPPageComm) 
	ON_CBN_SELCHANGE(IDC_BAUDRATE, OnSelchangeBaudrate) 
	ON_CBN_SELCHANGE(IDC_COMMPORT, OnSelchangeCommport) 
	ON_CBN_SELCHANGE(IDC_DATABIT, OnSelchangeDatabit) 
	ON_CBN_SELCHANGE(IDC_PARITYBIT, OnSelchangeParitybit) 
	ON_CBN_SELCHANGE(IDC_STOPBIT, OnSelchangeStopbit) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CPPageComm message handlers 
 
void CPPageComm::SetCombCurSel(UINT nIDComb, UINT index) 
{ 
	CWnd* pWnd = GetDlgItem(nIDComb); 
	CComboBox* p_comb; 
	p_comb = (CComboBox*)pWnd; 
	p_comb->SetCurSel(index); 
} 
 
UINT CPPageComm::GetCombCurSel(UINT nIDComb) 
{ 
	CWnd* pWnd = GetDlgItem(nIDComb); 
	CComboBox* p_comb; 
	p_comb = (CComboBox*)pWnd; 
	return p_comb->GetCurSel(); 
} 
 
BOOL CPPageComm::OnInitDialog()  
{ 
	CPropertyPage::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	SetCombCurSel(IDC_COMMPORT,m_commport); 
	SetCombCurSel(IDC_BAUDRATE,m_baudrate); 
	SetCombCurSel(IDC_DATABIT,m_databit); 
	SetCombCurSel(IDC_PARITYBIT,m_paritybit); 
	SetCombCurSel(IDC_STOPBIT,m_stopbit); 
 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CPPageComm::OnSelchangeBaudrate()  
{ 
	m_baudrate = GetCombCurSel(IDC_BAUDRATE);	 
} 
 
void CPPageComm::OnSelchangeCommport()  
{ 
	m_commport = GetCombCurSel(IDC_COMMPORT);	 
} 
 
void CPPageComm::OnSelchangeDatabit()  
{ 
	m_databit = GetCombCurSel(IDC_DATABIT);		 
} 
 
void CPPageComm::OnSelchangeParitybit()  
{ 
	m_paritybit = GetCombCurSel(IDC_PARITYBIT);	 
} 
 
void CPPageComm::OnSelchangeStopbit()  
{ 
	m_stopbit = GetCombCurSel(IDC_STOPBIT);	 
}