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

📄 settingsdlg.cpp

📁 vc++6.0开发网络典型应用实例导航 1. 本光盘提供了本书中所有的实例源程序文件。 2. 附录文件夹下是Winsock 函数参考以及错误码列表
💻 CPP
字号:
/********************************************************************/
/*																	*/
/*  SettingsDlg.cpp													*/
/*																	*/
/*	This class is a part of the Mini ASP Web Server					*/
/*																	*/
/*  Programmed by Pablo van der Meer								*/
/*	http://www.pablovandermeer.nl									*/
/*																	*/
/*  Last updated: July 4, 2003										*/
/*																	*/
/********************************************************************/

#include "stdafx.h"
#include "server.h"
#include "SettingsDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif



CSettingsDlg::CSettingsDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSettingsDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSettingsDlg)
	m_strWebPages = _T("");
	m_strDefaultPage = _T("");
	m_bAutoStart = FALSE;
	m_nPort = 80;
	//}}AFX_DATA_INIT
}


void CSettingsDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSettingsDlg)
	DDX_Text(pDX, IDC_WEBPAGES, m_strWebPages);
	DDX_Text(pDX, IDC_DEFAULTPAGE, m_strDefaultPage);
	DDX_Check(pDX, IDC_AUTO_START, m_bAutoStart);
	DDX_Text(pDX, IDC_PORT, m_nPort);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSettingsDlg, CDialog)
	//{{AFX_MSG_MAP(CSettingsDlg)
	ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
	ON_BN_CLICKED(IDC_FILEBROWSE, OnFilebrowse)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/********************************************************************/
/*																	*/
/* Function name : OnBrowse											*/		
/* Description   : Browse for folder								*/
/*																	*/
/********************************************************************/
void CSettingsDlg::OnBrowse() 
{
	UpdateData();
	CString strDir = BrowseForFolder(m_hWnd, "Select a directory:", BIF_RETURNONLYFSDIRS);
	if (!strDir.IsEmpty())
	{
		m_strWebPages = strDir;
		UpdateData(FALSE);
	}	
}


/********************************************************************/
/*																	*/
/* Function name : OnFilebrowse										*/		
/* Description   : Browse for file									*/
/*																	*/
/********************************************************************/
void CSettingsDlg::OnFilebrowse() 
{
	UpdateData();

	char szFilters[] = "HTML Files (*.html)|*.*|All Files (*.*)|*.*||";
	
	CFileDialog dlg(TRUE, "html","*.html", OFN_NOVALIDATE| OFN_HIDEREADONLY, szFilters, this);

	dlg.m_ofn.lpstrTitle = "Select the default web page";
	dlg.m_ofn.lpstrInitialDir = m_strWebPages;

	if (dlg.DoModal() == IDOK)
	{
		m_strDefaultPage = dlg.GetFileName();
		UpdateData(FALSE);
	}
}

⌨️ 快捷键说明

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