www.pudn.com > IPServer.rar > ConfigDlg.cpp


// ConfigDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "atlbase.h" 
#include "IpRegDemo.h" 
#include "ConfigDlg.h" 
#include ".\configdlg.h" 
#include  
using namespace std; 
 
int GetConfig(BOOL *plog, BOOL *prunatstart); 
void GetCurrentPath(char *path); 
// CConfigDlg dialog 
 
IMPLEMENT_DYNAMIC(CConfigDlg, CDialog) 
CConfigDlg::CConfigDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CConfigDlg::IDD, pParent) 
	, m_runatstart(FALSE) 
	, m_log(FALSE) 
{ 
} 
 
CConfigDlg::~CConfigDlg() 
{ 
} 
 
BOOL CConfigDlg::OnInitDialog() 
{ 
	CDialog::OnInitDialog(); 
	if (GetConfig(&m_log, &m_runatstart)==0) 
	{ 
			UpdateData(FALSE); 
	} 
 
	/*FILE *fpConfig; 
	char line[100]; 
	string strRun; 
	string strLog; 
	string strRemain; 
	int pos; 
 
	char path[100]; 
	GetCurrentPath(path); 
	strcat(path,"\\ConfigLog.txt"); 
	if ( (fpConfig = fopen(path, "r"))== NULL) 
	{ 
		TRACE("Open ConfigLog.txt error\n"); 
		return FALSE; 
	} 
 
	fgets(line,100, fpConfig); 
	strLog=string(line); 
	pos = strLog.find_first_of('\t'); 
	strRemain=strLog.substr(pos+1,pos+4); 
 
	TRACE("strLog=%s",strLog.c_str()); 
	if (strncmp("yes",strRemain.c_str(),3)== 0)	 
	{ 
		m_log=TRUE; 
	} 
	else 
	{ 
		m_log=FALSE; 
	} 
 
	fgets(line,100,fpConfig); 
	strRun=string(line); 
 
	pos = strRun.find_first_of('\t'); 
 
	strRemain=strRun.substr(pos+1); 
	TRACE("strRun=%s",strRun.c_str()); 
	if (strncmp("yes",strRemain.c_str(),3)== 0) 
		m_runatstart=TRUE; 
	else 
		m_runatstart=FALSE; 
 
	fclose(fpConfig);*/ 
 
	return TRUE; 
} 
 
void CConfigDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	DDX_Check(pDX, IDC_CHECK_RUNATSTART, m_runatstart); 
	DDX_Check(pDX, IDC_CHECK_LOG, m_log); 
 
	DDX_Control(pDX, IDC_CHECK_RUNATSTART, m_btnRunAtStart); 
} 
 
 
BEGIN_MESSAGE_MAP(CConfigDlg, CDialog) 
	ON_BN_CLICKED(IDC_BUTTON_CONFIG, OnBnClickedButtonConfig) 
	ON_BN_CLICKED(IDC_BUTTON_CANCEL, OnBnClickedButtonCancel) 
END_MESSAGE_MAP() 
 
 
// CConfigDlg message handlers 
 
void CConfigDlg::OnBnClickedButtonConfig() 
{ 
	// TODO: Add your control notification handler code here 
	CDialog::OnOK(); 
} 
 
void CConfigDlg::OnBnClickedButtonCancel() 
{ 
	// TODO: Add your control notification handler code here 
	CDialog::OnCancel(); 
}