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

📄 inputdlg.cpp

📁 1.MyIE开源工程协议 MyIE开源工程遵循GNU通用公共许可证GPL(GNU General Public License)开发,任何人都可以永久免费安装使用,在你下载和使用MyIE源代码前,请
💻 CPP
字号:
// InputDlg.cpp : implementation file
//

#include "stdafx.h"
#include "MyIE.h"
#include "InputDlg.h"
#include "MainFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CInputDlg dialog


CInputDlg::CInputDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CInputDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CInputDlg)
	m_strMsg = _T("");
	m_strOutput = _T("");
	//}}AFX_DATA_INIT
	m_nOKType = 0;
	m_bSave = FALSE;
}


void CInputDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CInputDlg)
	DDX_Control(pDX, IDC_OUTPUT, m_output);
	DDX_Text(pDX, IDC_MSG, m_strMsg);
	DDX_Text(pDX, IDC_OUTPUT, m_strOutput);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CInputDlg, CDialog)
	//{{AFX_MSG_MAP(CInputDlg)
	ON_BN_CLICKED(IDC_UP_URL, OnUpUrl)
	ON_BN_CLICKED(IDC_COPY, OnCopy)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CInputDlg message handlers

BOOL CInputDlg::OnInitDialog() 
{
	LOADDLG("DialogInput");
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CEdit *p = (CEdit*)GetDlgItem(IDC_OUTPUT);
	//
	CString str;
	if (!IS_URL(m_strOutput))
	{
		//GetDlgItem(IDC_UP_URL)->ShowWindow(FALSE);
		LOADSTR(str ,IDS_SAVE);
		GetDlgItem(IDC_UP_URL)->SetWindowText(str);
		m_bSave = TRUE;
	}
	if (m_nOKType)
	{
		LOADSTR(str ,ID_LL_OPEN_SELECT);
		GetDlgItem(IDOK)->SetWindowText(str);
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CInputDlg::OnUpUrl() 
{
	// TODO: Add your control notification handler code here
	CString strUrl,strUrlUp;
	m_output.GetWindowText(strUrl);
	if (m_bSave)
	{
		if (strUrl.GetLength()<1)
			return;
		CString str;
		LOADSTR(str ,IDS_TYPE_COLLECTOR);
		CString strFileName;
		GET_FILE_NAME(strFileName,strUrl)
 		CFileDialog dlg(FALSE, "txt", strFileName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, str);
		if (dlg.DoModal()==IDOK)
		{
			CFile f;
			if(f.Open(dlg.GetPathName(), CFile::modeCreate|CFile::modeWrite|CFile::shareDenyNone))
			{
				f.Write((void*)(LPCSTR)strUrl, strUrl.GetLength());
				f.Close();
			}
			OnCancel();
		}
	}
	else
	{
		//up url
		strUrlUp = _StringGetUpUrl(strUrl);
		if (strUrl != strUrlUp)
		{
			m_output.SetWindowText(strUrlUp);
			m_output.SetFocus();
			m_output.SetSel(0,-1);
		}
	}
}

void CInputDlg::OnCopy() 
{
	// TODO: Add your control notification handler code here
	int nStart, nEnd;
	CString strText, strCode;

	m_output.GetWindowText(strText);
	m_output.GetSel(nStart,nEnd);
	if (nStart<nEnd && nStart>=0 && nEnd>=0)
		strText = strText.Mid(nStart,nEnd-nStart);
	//
	_SetClipString(strText);
	OnCancel();
}

⌨️ 快捷键说明

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