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

📄 docseldlg.cpp

📁 基于SVM的文本分类算法
💻 CPP
字号:
// DocSelDlg.cpp : implementation file
//

#include "stdafx.h"
#include "svmcls.h"
#include "DocSelDlg.h"
#include "WzdDrDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDocSelDlg dialog


CDocSelDlg::CDocSelDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CDocSelDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDocSelDlg)
	m_nPercent = 67;
	m_strSource = _T("");
	m_strTarget = _T("");
	//}}AFX_DATA_INIT
}


void CDocSelDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDocSelDlg)
	DDX_Text(pDX, IDC_EDIT_PERCENT, m_nPercent);
	DDV_MinMaxInt(pDX, m_nPercent, 1, 99);
	DDX_Text(pDX, IDC_EDIT_SOURCE, m_strSource);
	DDX_Text(pDX, IDC_EDIT_TARGET, m_strTarget);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDocSelDlg, CDialog)
	//{{AFX_MSG_MAP(CDocSelDlg)
	ON_BN_CLICKED(IDC_BTN_BROWSE1, OnBtnBrowse1)
	ON_BN_CLICKED(IDC_BTN_BROWSE2, OnBtnBrowse2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDocSelDlg message handlers

void CDocSelDlg::OnBtnBrowse1() 
{
	UpdateData(TRUE);	
	CWzdDirDlg dlg;
	CString dir=dlg.GetDirectory(this,m_strSource);
	if(!dir.IsEmpty())
	{
		m_strSource=dir;
		UpdateData(FALSE);	
	}
}

void CDocSelDlg::OnBtnBrowse2() 
{
	UpdateData(TRUE);	
	CWzdDirDlg dlg;
	CString dir=dlg.GetDirectory(this,m_strTarget);
	if(!dir.IsEmpty())
	{
		m_strTarget=dir;
		UpdateData(FALSE);	
	}
}

void CDocSelDlg::OnOK() 
{
	UpdateData(TRUE);
	if(m_strSource.IsEmpty()||m_strTarget.IsEmpty())
	{
		AfxMessageBox("源文档或目标文档所在目录不能为空!");
		return;
	}
	if(!SetCurrentDirectory(m_strSource))
	{
		AfxMessageBox("源文档目录不存在!");
		return;
	}
	if(m_strTarget.Find(m_strSource)>=0)
	{
		AfxMessageBox("\"目标文档目录\"不能是\"源文档目录\"的子目录!");
		return;
	}
	if(m_nPercent<=0||m_nPercent>=100)
	{
		AfxMessageBox("训练文档所占比例必须在0-100之间!");
		return;
	}
	if(!SetCurrentDirectory(m_strTarget))
	{
		if(!CreateDirectory(m_strTarget,NULL))
		{
			AfxMessageBox("无法创建目标文档目录!");
			return;
		}
	}
	CDialog::OnOK();
}

⌨️ 快捷键说明

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