www.pudn.com > VPNClient-Source.rar > DialogAdd.cpp


// DialogAdd.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "vpnclient.h" 
#include "DialogAdd.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CDialogAdd dialog 
 
 
CDialogAdd::CDialogAdd(CWnd* pParent /*=NULL*/) 
	: CDialog(CDialogAdd::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CDialogAdd) 
	m_Username = _T(""); 
	m_Password = _T(""); 
	m_Host = _T(""); 
	m_Description = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
 
void CDialogAdd::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CDialogAdd) 
	DDX_Text(pDX, IDC_USERNAME, m_Username); 
	DDX_Text(pDX, IDC_PASSWORD, m_Password); 
	DDX_Text(pDX, IDC_HOST, m_Host); 
	DDX_Text(pDX, IDC_DESCRIPTION, m_Description); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CDialogAdd, CDialog) 
	//{{AFX_MSG_MAP(CDialogAdd) 
	ON_BN_CLICKED(IDC_CONFIRM, OnConfirm) 
	ON_BN_CLICKED(IDC_CLOSE, OnClose) 
	ON_EN_CHANGE(IDC_HOST, OnChangeHost) 
	ON_EN_CHANGE(IDC_USERNAME, OnChangeUsername) 
	ON_EN_CHANGE(IDC_PASSWORD, OnChangePassword) 
	ON_EN_CHANGE(IDC_DESCRIPTION, OnChangeDescription) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CDialogAdd message handlers 
 
 
BOOL CDialogAdd::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CDialogAdd::OnConfirm()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(TRUE); 
	EndDialog(IDC_CONFIRM); 
} 
 
void CDialogAdd::OnClose()  
{ 
	// TODO: Add your control notification handler code here 
	OnCancel(); 
} 
 
void CDialogAdd::CheckInput() 
{ 
	UpdateData(TRUE); 
	if (m_Host.GetLength() && m_Username.GetLength() && m_Password.GetLength() && m_Description.GetLength()) 
	{ 
		GetDlgItem(IDC_CONFIRM)->EnableWindow(TRUE); 
	} 
	else 
	{ 
		GetDlgItem(IDC_CONFIRM)->EnableWindow(FALSE); 
	} 
} 
 
void CDialogAdd::OnChangeHost()  
{ 
	// TODO: If this is a RICHEDIT control, the control will not 
	// send this notification unless you override the CDialog::OnInitDialog() 
	// function and call CRichEditCtrl().SetEventMask() 
	// with the ENM_CHANGE flag ORed into the mask. 
	 
	// TODO: Add your control notification handler code here 
	CheckInput(); 
} 
 
void CDialogAdd::OnChangeUsername()  
{ 
	// TODO: If this is a RICHEDIT control, the control will not 
	// send this notification unless you override the CDialog::OnInitDialog() 
	// function and call CRichEditCtrl().SetEventMask() 
	// with the ENM_CHANGE flag ORed into the mask. 
	 
	// TODO: Add your control notification handler code here 
	CheckInput(); 
} 
 
void CDialogAdd::OnChangePassword()  
{ 
	// TODO: If this is a RICHEDIT control, the control will not 
	// send this notification unless you override the CDialog::OnInitDialog() 
	// function and call CRichEditCtrl().SetEventMask() 
	// with the ENM_CHANGE flag ORed into the mask. 
	 
	// TODO: Add your control notification handler code here 
	CheckInput(); 
} 
 
void CDialogAdd::OnChangeDescription()  
{ 
	// TODO: If this is a RICHEDIT control, the control will not 
	// send this notification unless you override the CDialog::OnInitDialog() 
	// function and call CRichEditCtrl().SetEventMask() 
	// with the ENM_CHANGE flag ORed into the mask. 
	 
	// TODO: Add your control notification handler code here 
	CheckInput(); 
}