⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proppageprotocolftp.cpp

📁 ftpserver very good sample
💻 CPP
字号:
// PropPageProtocolFtp.cpp : implementation file//#include "stdafx.h"#include "warmmcsnapin.h"#include "PropPageProtocolFtp.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CPropPageProtocolFtp property pageIMPLEMENT_DYNCREATE(CPropPageProtocolFtp, CPropertyPage)CPropPageProtocolFtp::CPropPageProtocolFtp(war_if_site_ptr_t& rSitePtr) : CPropertyPage(CPropPageProtocolFtp::IDD),mSitePtr(rSitePtr){	//{{AFX_DATA_INIT(CPropPageProtocolFtp)	m_bEnable = mSitePtr->IsProtocolEnabled(WarIfSite::PROT_FTP);	m_Hostname = _T("");	m_Port = _T("");	//}}AFX_DATA_INIT    CString site_addr = mSitePtr->GetAddress(WarIfSite::PROT_FTP).c_str();    LPCTSTR p = site_addr;    while(*p && (':' != *p))        m_Hostname += *p++;    if (*p)        ++p;    while(*p)        m_Port += *p++;}CPropPageProtocolFtp::~CPropPageProtocolFtp(){}void CPropPageProtocolFtp::DoDataExchange(CDataExchange* pDX){	CPropertyPage::DoDataExchange(pDX);	//{{AFX_DATA_MAP(CPropPageProtocolFtp)	DDX_Check(pDX, IDC_ENABLE, m_bEnable);	DDX_Text(pDX, IDC_HOSTNAME, m_Hostname);	DDX_CBString(pDX, IDC_PORT, m_Port);	//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CPropPageProtocolFtp, CPropertyPage)	//{{AFX_MSG_MAP(CPropPageProtocolFtp)	ON_BN_CLICKED(IDC_ENABLE, OnEnable)	ON_EN_CHANGE(IDC_HOSTNAME, OnChange)	ON_CBN_EDITCHANGE(IDC_PORT, OnChange)	ON_CBN_SELCHANGE(IDC_PORT, OnChange)	//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CPropPageProtocolFtp message handlersvoid CPropPageProtocolFtp::DoSetStates(){    UpdateData();    GetDlgItem(IDC_HOSTNAME)->EnableWindow(m_bEnable);    GetDlgItem(IDC_PORT)->EnableWindow(m_bEnable);}BOOL CPropPageProtocolFtp::OnApply() {    UpdateData();    if (m_Hostname.IsEmpty())        m_Hostname = _T("*");    if (m_Port.IsEmpty())        m_Port = _T("ftp");    if (_tcschr(m_Hostname, ':') || _tcschr(m_Port, ':'))    {        AfxMessageBox(IDS_ILLEGALCHARINADDRORPORT);        return FALSE;    }    CString address;    address.Format(_T("%s:%s"), m_Hostname, m_Port);    mSitePtr->SetEnableProtocol(WarIfSite::PROT_FTP, m_bEnable);    mSitePtr->SetAdress(WarIfSite::PROT_FTP, address);		return CPropertyPage::OnApply();}void CPropPageProtocolFtp::OnEnable() {	UpdateData();    SetModified();    DoSetStates();}void CPropPageProtocolFtp::OnChange() {	SetModified();}BOOL CPropPageProtocolFtp::OnInitDialog() {	CPropertyPage::OnInitDialog();		DoSetStates();		return TRUE;  // return TRUE unless you set the focus to a control	              // EXCEPTION: OCX Property Pages should return FALSE}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -