www.pudn.com > CraftFTP_gb.rar > ConnectWizardPage4.cpp


// ConnectWizardPage4.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "CraftFTP.h" 
#include "ConnectWizardPage4.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CConnectWizardPage4 property page 
const DWORD CConnectWizardPage4::m_nHelpIDs[] = 
{ 
	IDC_EDIT_USERNAME,	HIDC_EDIT_USERNAME, 
	IDC_EDIT_PASSWORD,	HIDC_EDIT_PASSWORD, 
	IDC_EDIT_FTPPORT,	HIDC_EDIT_FTPPORT, 
	IDC_SPIN_FTPPORT,	HIDC_SPIN_FTPPORT, 
	IDC_CHECK_ANONYMOUS,HIDC_CHECK_ANONYMOUS, 
	0 , 0 
}; 
 
IMPLEMENT_DYNCREATE(CConnectWizardPage4, CPropertyPageExt) 
 
CConnectWizardPage4::CConnectWizardPage4() : CPropertyPageExt(CConnectWizardPage4::IDD) 
{ 
	CWinApp * theApp = AfxGetApp(); 
 
	//{{AFX_DATA_INIT(CConnectWizardPage4) 
	m_bAnonymousLogin	= TRUE; 
	m_szUserName		= _T("anonymous"); 
	m_szPassWord		= theApp->GetProfileString(_T("General"), _T("AnommousEmail"), _T("yourname@yourcompany.com")); 
	m_nPort				= 21; 
	//}}AFX_DATA_INIT 
} 
 
CConnectWizardPage4::~CConnectWizardPage4() 
{ 
} 
 
void CConnectWizardPage4::DoDataExchange(CDataExchange* pDX) 
{ 
	CPropertyPageExt::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CConnectWizardPage4) 
	DDX_Check(pDX, IDC_CHECK_ANONYMOUS, m_bAnonymousLogin); 
	DDX_Text(pDX, IDC_EDIT_USERNAME, m_szUserName); 
	DDX_Text(pDX, IDC_EDIT_PASSWORD, m_szPassWord); 
	DDX_Text(pDX, IDC_EDIT_FTPPORT, m_nPort); 
	DDV_MinMaxUInt(pDX, m_nPort, 0, 65535); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CConnectWizardPage4, CPropertyPageExt) 
	//{{AFX_MSG_MAP(CConnectWizardPage4) 
	ON_BN_CLICKED(IDC_CHECK_ANONYMOUS, OnCheckAnonymousLogin) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CConnectWizardPage4 message handlers 
 
BOOL CConnectWizardPage4::OnSetActive()  
{ 
	// TODO: Add your specialized code here and/or call the base class 
	CPropertySheet * pSheet = (CPropertySheet*)GetParent(); 
    ASSERT_KINDOF(CPropertySheet, pSheet); 
    pSheet->SetWizardButtons(PSWIZB_BACK|PSWIZB_NEXT); 
 
	return CPropertyPageExt::OnSetActive(); 
} 
 
void CConnectWizardPage4::OnCheckAnonymousLogin()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(); 
 
	CWinApp * theApp = AfxGetApp(); 
	if(m_bAnonymousLogin) 
	{ 
		m_szUserName = _T("anonymous"); 
		m_szPassWord = theApp->GetProfileString(_T("General"), _T("AnommousEmail"), _T("yourname@yourcompany.com")); 
	} 
 
	UpdateData(FALSE); 
} 
 
BOOL CConnectWizardPage4::OnInitDialog()  
{ 
	CPropertyPageExt::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	CWnd * pEditCtrl = GetDlgItem(IDC_EDIT_FTPPORT); 
	CSpinButtonCtrl * pCtrl = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_FTPPORT); 
	if(pCtrl && pEditCtrl) 
	{ 
		pCtrl->SetBuddy(pEditCtrl); 
		pCtrl->SetRange32(0, 65535); 
	} 
	 
	UpdateData(FALSE); 
 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
}