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

📄 downaddjob.cpp

📁 模拟迅雷的下载工具软件
💻 CPP
字号:
// DownAddJob.cpp : implementation file
//

#include "stdafx.h"
#include "LeoBlock2004.h"
#include "DownAddJob.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDownAddJob property page

IMPLEMENT_DYNCREATE(CDownAddJob, CPropertyPage)

CDownAddJob::CDownAddJob() : CPropertyPage(CDownAddJob::IDD)
{
	//{{AFX_DATA_INIT(CDownAddJob)
	m_chbRename = FALSE;
	//}}AFX_DATA_INIT
}
CDownAddJob::CDownAddJob(void *lParam) : CPropertyPage(CDownAddJob::IDD)
{
	st_DropUrl=(DROP_URL*)lParam;
	m_bFileName=FALSE;
	
}



CDownAddJob::~CDownAddJob()
{
}

void CDownAddJob::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDownAddJob)
	DDX_Control(pDX, IDC_BUTTON_PATH, m_buPath);
	DDX_Control(pDX, IDC_EDIT_SAFE, m_eSavePath);
	DDX_Control(pDX, IDC_EDIT_COMMENT, m_eComment);
	DDX_Control(pDX, IDC_URL, m_eUrl);
	DDX_Control(pDX, IDC_EDIT_RENAME, m_eReName);
	DDX_Check(pDX, IDC_CHECK_RENAME, m_chbRename);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDownAddJob, CPropertyPage)
	//{{AFX_MSG_MAP(CDownAddJob)
	ON_BN_CLICKED(IDC_BUTTON_PATH, OnButtonPath)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDownAddJob message handlers

void CDownAddJob::OnButtonPath() 
{
	// TODO: Add your control notification handler code here
	CFileInfo nFileInfo;
	nFileInfo.m_strTitle=_T("请选择目录");

	if(nFileInfo.BrowseForFolder(GetParent())==IDOK)
	{
		m_eSavePath.SetWindowText((LPCTSTR)nFileInfo.m_strPath);
	}
	UpdateData(FALSE);
	
}

BOOL CDownAddJob::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_eComment.SetWindowText((LPCTSTR)st_DropUrl->strComment);
	m_eUrl.SetWindowText((LPCTSTR)st_DropUrl->strLocatinUrl);
	m_eSavePath.SetWindowText((LPCTSTR)st_DropUrl->strPathName);
	m_eReName.SetWindowText((LPCTSTR)st_DropUrl->strFileName);
	m_pMainWnd=st_DropUrl->pMainWnd;
	m_chbRename=st_DropUrl->bRename;
	UpdateData(FALSE);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDownAddJob::OnOK() 
{
	
	// TODO: Add your specialized code here and/or call the base class
	//Sand Message to MainFrame 
	UpdateData();

	DROP_URL pDropUrl;
	CString sComment,sUrl,sPathName,sFileName;
	CFileFind FileFind;

	m_eUrl.GetWindowText(sUrl);
	if(!sUrl.IsEmpty())
	{
		m_eComment.GetWindowText(sComment);
		m_eSavePath.GetWindowText(sPathName);
		if(FileFind.FindFile((LPCTSTR)sPathName))
		{
			m_eReName.GetWindowText(sFileName);
			if(!sFileName.IsEmpty())
			{
				pDropUrl.strComment=sComment;
				pDropUrl.strLocatinUrl=sUrl;
				sPathName+="\\";
				sPathName+=sFileName;
				pDropUrl.strFilePath=sPathName;
				pDropUrl.pMainWnd=m_pMainWnd;
				pDropUrl.nBreakRev=0;  //break no
				pDropUrl.bRename=m_chbRename;
				::SendMessage(st_DropUrl->pMainWnd->m_hWnd,WM_DOWNADDJOBPAGE,0,(LPARAM)&pDropUrl);

			}
			else
			{
				MessageBox("文件名无效,请重新输入!","Leo",MB_OK|MB_ICONSTOP);
				return;
			}
		}
		else
		{
			MessageBox("路径无效,请重新输入!","Leo",MB_OK|MB_ICONSTOP);
			return;
		}

	}
	else
	{
		MessageBox("URL为空请重输!","Leo",MB_OK|MB_ICONSTOP);
		return;
	}
	FileFind.Close();
	CPropertyPage::OnOK();
}


⌨️ 快捷键说明

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