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

📄 folderseldlg.cpp

📁 一个集成的文本阅读工具
💻 CPP
字号:
// FolderSelDlg.cpp : implementation file
//

#include "stdafx.h"
#include "TipReader.h"
#include "FolderSelDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CFolderSelDlg dialog


CFolderSelDlg::CFolderSelDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CFolderSelDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CFolderSelDlg)
	m_path = _T("");
	//}}AFX_DATA_INIT
}


void CFolderSelDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFolderSelDlg)
	DDX_Control(pDX, IDC_EDIT1, m_edit);
	DDX_Control(pDX, IDC_DIRLIST, m_dir);
	DDX_Text(pDX, IDC_EDIT1, m_path);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CFolderSelDlg, CDialog)
	//{{AFX_MSG_MAP(CFolderSelDlg)
	ON_LBN_SELCHANGE(IDC_DIRLIST, OnSelchangeDirlist)
	ON_LBN_DBLCLK(IDC_DIRLIST, OnDblclkDirlist)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFolderSelDlg message handlers

BOOL CFolderSelDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	//this->m_dir.Dir(0x0010,"c:\\*.");
	this->m_dir.Dir(DDL_DRIVES,"*.");
	this->m_edit.SetWindowText("请选择一个路径!");
	//this->m_dir
	this->m_folderpath="";
	this->m_curfolder="";
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CFolderSelDlg::OnSelchangeDirlist() 
{
	// TODO: Add your control notification handler code here
}

void CFolderSelDlg::OnDblclkDirlist() 
{
	// TODO: Add your control notification handler code here
	CString folder;

	this->m_dir.GetText(this->m_dir.GetCurSel(),folder);
	if(""==this->m_folderpath)
	{
		folder=folder.Mid(2,1);
		folder+=":\\";
		this->m_curfolder=folder;
		this->m_folderpath=folder;
	}
	else
	{
		folder.TrimLeft('[');
		folder.TrimRight(']');
		if(folder!="..")
		{
			folder+="\\";
			this->m_curfolder=folder;
			this->m_folderpath+=folder;
		}
		else
		{

			this->m_folderpath=this->m_folderpath.Left(this->m_folderpath.GetLength()-this->m_curfolder.GetLength());
			this->m_curfolder=this->m_folderpath.Right(this->m_folderpath.GetLength()-this->m_folderpath.ReverseFind('\\'));
			if(m_curfolder=="\\")
			{
				this->m_folderpath.TrimRight('\\');
				this->m_curfolder=this->m_folderpath.Right(this->m_folderpath.GetLength()-this->m_folderpath.ReverseFind('\\'));	
			}
			if(this->m_folderpath.GetLength()==2)
				this->m_folderpath+="\\";
		}
	}
	this->m_dir.ResetContent();
	this->m_dir.Dir(DDL_DIRECTORY,this->m_folderpath+"\\*.");
	this->m_edit.SetWindowText(this->m_folderpath);

}

void CFolderSelDlg::OnOK() 
{
	// TODO: Add extra validation here

	CDialog::OnOK();
}

void CFolderSelDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here

	this->m_dir.ResetContent();
	this->m_dir.Dir(DDL_DRIVES,"*.");
	this->m_edit.SetWindowText("请选择一个路径!");
	this->m_folderpath="";
	this->m_curfolder="";
}

⌨️ 快捷键说明

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