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


// SysSetDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "ParkSys.h" 
#include "SysSetDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CSysSetDlg 
 
IMPLEMENT_DYNAMIC(CSysSetDlg, CPropertySheet) 
 
CSysSetDlg::CSysSetDlg(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage) 
	:CPropertySheet(pszCaption, pParentWnd, iSelectPage) 
{ 
	//去掉Apply按钮 
	m_psh.dwFlags |= PSH_NOAPPLYNOW; 
} 
 
CSysSetDlg::~CSysSetDlg() 
{ 
} 
 
BEGIN_MESSAGE_MAP(CSysSetDlg, CPropertySheet) 
	//{{AFX_MSG_MAP(CSysSetDlg) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CSysSetDlg message handlers 
 
///////////////////////////////////////////////////////////////////////////// 
// CDbDlg message handlers 
 
 
BOOL CSysSetDlg::Init() 
{ 
	const int nDim = 3; 
	UINT Resources[nDim][2] =  
	{ 
		{IDD_PROPPAGE_COMM,IDS_PPAGELABELPRIENT}		 
		,{IDD_PROPPAGE_CAPACITY,IDS_PPAGECAPACITY} 
		,{IDD_PROPPAGE_COMM,IDS_PPAGELED} 
	}; 
	CPropertyPage *Pages[nDim] = { 
		 &pageLPComm		 
		, &pageCapacity 
		, &pageLEDComm 
		}; 
	for (int i = 0; i < nDim; i++ ) 
	{ 
		Pages[i]->Construct(Resources[i][0], Resources[i][1]); 
		AddPage(Pages[i]); 
	} 
 
	//加载配置 
	LoadConfigration(); 
 
	return TRUE; 
} 
 
BOOL CSysSetDlg::SaveConfigration(void) 
{ 
	//写注册表串口信息 
	CRegKey regKey; 
	regKey.Open(HKEY_CURRENT_USER,_T("Software\\ParkSys\\CommSet")); 
 
	regKey.SetValue(pageLPComm.m_commport, _T("LPComm")); 
	regKey.SetValue(pageLPComm.m_baudrate, _T("LPBaud")); 
	regKey.SetValue(pageLPComm.m_databit, _T("LPData")); 
	regKey.SetValue(pageLPComm.m_paritybit, _T("LPParity")); 
	regKey.SetValue(pageLPComm.m_stopbit, _T("LPStop")); 
 
	regKey.SetValue(pageLEDComm.m_commport, _T("LEDComm")); 
	regKey.SetValue(pageLEDComm.m_baudrate, _T("LEDBaud")); 
	regKey.SetValue(pageLEDComm.m_databit, _T("LEDData")); 
	regKey.SetValue(pageLEDComm.m_paritybit, _T("LEDParity")); 
	regKey.SetValue(pageLEDComm.m_stopbit, _T("LEDStop")); 
 
	regKey.Close(); 
 
	//写停车场参数 
	regKey.Open(HKEY_CURRENT_USER,_T("Software\\ParkSys\\ParaSet")); 
	regKey.SetValue(pageCapacity.m_Capacity, _T("Park_capacity")); 
	regKey.Close(); 
 
	regKey.Close(); 
 
	return TRUE; 
} 
 
BOOL CSysSetDlg::LoadConfigration() 
{ 
	//读注册表串口信息 
	CRegKey regKey; 
	regKey.Open(HKEY_CURRENT_USER,_T("Software\\ParkSys\\CommSet")); 
 
	regKey.QueryValue(pageLPComm.m_commport, "LPComm"); 
	regKey.QueryValue(pageLPComm.m_baudrate, "LPBaud"); 
	regKey.QueryValue(pageLPComm.m_databit, "LPData"); 
	regKey.QueryValue(pageLPComm.m_paritybit,"LPParity"); 
	regKey.QueryValue(pageLPComm.m_stopbit, "LPStop"); 
 
	regKey.QueryValue(pageLEDComm.m_commport,"LEDComm"); 
	regKey.QueryValue(pageLEDComm.m_baudrate,"LEDBaud"); 
	regKey.QueryValue(pageLEDComm.m_databit, "LEDData"); 
	regKey.QueryValue(pageLEDComm.m_paritybit, "LEDParity"); 
	regKey.QueryValue(pageLEDComm.m_stopbit, "LEDStop"); 
 
	regKey.Close(); 
		 
	//读停车场参数 
	regKey.Open(HKEY_CURRENT_USER,_T("Software\\ParkSys\\ParaSet")); 
	regKey.QueryValue(pageCapacity.m_Capacity, _T("Park_capacity")); 
	regKey.Close(); 
 
	return TRUE; 
}