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

📄 20090304.txt

📁    下载整个网站的源代码工具
💻 TXT
📖 第 1 页 / 共 3 页
字号:
		_T(".NET -> Managed C++"), 
		_T(".NET -> SOAP and XML"), 
		_T(".NET -> C++ Web Services"), 
		_T("MFC Controls -> Button Controls"), 
		_T("MFC Controls -> Dialog & Windows"), 
		_T("MFC Controls -> Combo & List Boxes"), 
		_T("MFC Controls -> Menus"), 
		_T("MFC Controls -> Toolbars & Docking Windows"), 
		_T("MFC Controls -> Status Bar"), 
		_T("MFC Controls -> Edit Controls"), 
		_T("MFC Controls -> List Controls"), 
		_T("MFC Controls -> Tree Controls"), 
		_T("MFC Controls -> Tab Controls"), 
		_T("MFC Controls -> Property Sheets"), 
		_T("MFC Controls -> Rich Edit Controls"), 
		_T("MFC Controls -> Splitter Windows"), 
		_T("MFC Controls -> Static Controls"), 
		_T("MFC Controls -> Miscellaneous Controls"), 
		_T("General - > COM/DCOM/COM+"), 
		_T("General - > C++/MFC"), 
		_T("General - > Clipboard"), 
		_T("General - > Doc/View"), 
		_T("General - > Debug tips"), 
		_T("General - > Database"), 
		_T("General - > Dlls"), 
		_T("General - > Files & Folders"), 
		_T("General - > Internet & Network"), 
		_T("General - > Macros and Add-ins"), 
		_T("General - > Printing"), 
		_T("General - > Samples"), 
		_T("General - > String"), 
		_T("General - > System"), 
		_T("General - > Threads, Processes & IPC"), 
		_T("General - > Programming tips"), 
		_T("General - > Free Tools"), 
		_T("General - > Shell Programming"), 
		_T("General - > Date & Time"), 
		_T("General - > WinHelp/HTMLHelp"), 
		_T("Libraries - > ATL"), 
		_T("Libraries - > WTL"), 
		_T("Libraries - > STL"), 
		_T("Libraries - > Libraries & Projects"), 
		_T("MultiMedia - > Bitmaps & Palettes"), 
		_T("MultiMedia - > Audio & Video"), 
		_T("MultiMedia - > DirectX"), 
		_T("MultiMedia - > OpenGL"), 
		_T("MultiMedia - > Fonts & GDI"), 
		_T("MultiMedia - > GDI+"), 
		_T("Platforms - > Win32/SDK"), 
		_T("Platforms - > Windows 2000/XP"), 
		_T("Platforms - > CE/Embedded"), 
		_T("Web/Scripting - > ISAPI") 
	}; 
	CString strItemUrl[] = { 
		_T("http://www.codeproject.com/managedcpp"), 
		_T("http://www.codeproject.com/soap"), 
		_T("http://www.codeproject.com/webservices"), 
		_T("http://www.codeproject.com/buttonctrl"), 
		_T("http://www.codeproject.com/dialog"), 
		_T("http://www.codeproject.com/combobox"), 
		_T("http://www.codeproject.com/menu"), 
		_T("http://www.codeproject.com/docking"), 
		_T("http://www.codeproject.com/statusbar"), 
		_T("http://www.codeproject.com/editctrl"), 
		_T("http://www.codeproject.com/listctrl"), 
		_T("http://www.codeproject.com/treectrl"), 
		_T("http://www.codeproject.com/tabctrl"), 
		_T("http://www.codeproject.com/property"), 
		_T("http://www.codeproject.com/richedit"), 
		_T("http://www.codeproject.com/splitter"), 
		_T("http://www.codeproject.com/staticctrl"), 
		_T("http://www.codeproject.com/miscctrl"), 
		_T("http://www.codeproject.com/com"), 
		_T("http://www.codeproject.com/cpp"), 
		_T("http://www.codeproject.com/clipboard"), 
		_T("http://www.codeproject.com/docview"), 
		_T("http://www.codeproject.com/debug"), 
		_T("http://www.codeproject.com/database"), 
		_T("http://www.codeproject.com/dll"), 
		_T("http://www.codeproject.com/file"), 
		_T("http://www.codeproject.com/internet"), 
		_T("http://www.codeproject.com/macro"), 
		_T("http://www.codeproject.com/printing"), 
		_T("http://www.codeproject.com/samples"), 
		_T("http://www.codeproject.com/string"), 
		_T("http://www.codeproject.com/system"), 
		_T("http://www.codeproject.com/threads"), 
		_T("http://www.codeproject.com/tips"), 
		_T("http://www.codeproject.com/tools"), 
		_T("http://www.codeproject.com/shell"), 
		_T("http://www.codeproject.com/datetime"), 
		_T("http://www.codeproject.com/winhelp"), 
		_T("http://www.codeproject.com/atl"), 
		_T("http://www.codeproject.com/wtl"), 
		_T("http://www.codeproject.com/vcpp/stl"), 
		_T("http://www.codeproject.com/library"), 
		_T("http://www.codeproject.com/bitmap"), 
		_T("http://www.codeproject.com/audio"), 
		_T("http://www.codeproject.com/directx"), 
		_T("http://www.codeproject.com/opengl"), 
		_T("http://www.codeproject.com/gdi"), 
		_T("http://www.codeproject.com/gdiplus"), 
		_T("http://www.codeproject.com/win32"), 
		_T("http://www.codeproject.com/w2k"), 
		_T("http://www.codeproject.com/ce"), 
		_T("http://www.codeproject.com/isapi") 
	}; 
	 
	ListView_SetExtendedListViewStyle(m_list.m_hWnd, LVS_EX_FULLROWSELECT|LVS_EX_INFOTIP|LVS_EX_FLATSB|LVS_EX_GRIDLINES|LVS_EX_CHECKBOXES); 
	m_list.InsertColumn(0, _T("下载项目"), LVCFMT_CENTER, 300); 
	m_list.InsertColumn(1, _T("URL"), LVCFMT_LEFT, 300); 
 
	//K 显示可选的下载项目 
	for(int i = 0; i < sizeof(strItem) / sizeof(CString); ++i) 
	{ 
		m_list.InsertItem(i, strItem[i]); 
		m_list.SetItemText(i, 1, strItemUrl[i]); 
	} 
	 
	m_editTargetDir.SetWindowText(_T("C:\\CodeProject")); 
 
	m_bWorking = FALSE; 
	//m_btnOK.EnableWindow(FALSE); 
 
	return TRUE;  // return TRUE  unless you set the focus to a control 
} 
 
// If you add a minimize button to your dialog, you will need the code below 
//  to draw the icon.  For MFC applications using the document/view model, 
//  this is automatically done for you by the framework. 
 
void CCodeProjectDlg::OnPaint()  
{ 
	if (IsIconic()) 
	{ 
		CPaintDC dc(this); // device context for painting 
 
		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); 
 
		// Center icon in client rectangle 
		int cxIcon = GetSystemMetrics(SM_CXICON); 
		int cyIcon = GetSystemMetrics(SM_CYICON); 
		CRect rect; 
		GetClientRect(&rect); 
		int x = (rect.Width() - cxIcon + 1) / 2; 
		int y = (rect.Height() - cyIcon + 1) / 2; 
 
		// Draw the icon 
		dc.DrawIcon(x, y, m_hIcon); 
	} 
	else 
	{ 
		CDialog::OnPaint(); 
	} 
} 
 
// The system calls this to obtain the cursor to display while the user drags 
//  the minimized window. 
HCURSOR CCodeProjectDlg::OnQueryDragIcon() 
{ 
	return (HCURSOR) m_hIcon; 
} 
 
void CCodeProjectDlg::OnOK()  
{ 
	m_btnOK.EnableWindow(FALSE); 
	m_bWorking = TRUE; 
 
	//K 取得输入的目标路径 
	m_editTargetDir.GetWindowText(m_strTargetDir); 
	m_strTargetDir.Replace(_T("\\"), _T("\\\\")); 
	if (m_strTargetDir.Right(2) != _T("\\\\")) m_strTargetDir += _T("\\\\"); 
 
	ConfirmDir(m_strTargetDir); 
 
	//K 取得到下载的项目 
	m_aryDownloadItem.RemoveAll(); 
	m_aryDownloadItemName.RemoveAll(); 
	int iItemNum = m_list.GetItemCount(); 
	for (int i = 0; i < iItemNum; ++i) 
	{ 
		if (ListView_GetCheckState(m_list.m_hWnd, i)) 
		{ 
			m_aryDownloadItemName.Add(m_list.GetItemText(i,0)); 
			m_aryDownloadItem.Add(m_list.GetItemText(i,1)); 
		} 
	} 
 
	m_editStatus.SetWindowText(_T("")); 
	 
	::AfxBeginThread(CCodeProjectDlg::Download, this->GetSafeHwnd(), THREAD_PRIORITY_NORMAL, 0); 
} 
 
UINT CCodeProjectDlg::Download(LPVOID pParam) 
{ 
	HWND hWnd = (HWND)pParam; 
 
	int i; 
	CString *pStr; 
	CInternetSession session("MyAgent", 1, INTERNET_OPEN_TYPE_PRECONFIG); 
 
	if (-1 == _taccess(m_strTargetDir + _T("global.css"), 0)) 
		DownloadFile(session, CString(_T("http://www.codeproject.com/styles/global.css")), m_strTargetDir + _T("global.css")); 
 
	//K 下载具体内容 
	for (i = 0; i < m_aryDownloadItem.GetSize(); ++i) 
	{ 
		pStr = new CString; 
		pStr->Format(_T("%s 开始下载!\n"), m_aryDownloadItemName[i]); 
		::PostMessage(hWnd, WM_USER_DOWNSTATUS, (WPARAM)pStr, 0); 
		 
		CString strTemp, strCurDir; 
		for(int j = 0; AfxExtractSubString(strTemp, m_aryDownloadItem[i], j, _T('/')); ++j) 
			strCurDir = strTemp; 
		ConfirmDir(m_strTargetDir + strCurDir + _T("\\\\")); 
 
		//K 下载分类索引的HTML文件 
		CString strItemGroup; 
		DownloadHtml(session, m_aryDownloadItem[i], strItemGroup); 
 
		//K 整理HTML文件的内容 
		CString strStart = _T(""), 
				strEnd	 = _T(""); 
		long iPotion; 
		iPotion = strItemGroup.Find(strStart); 
		iPotion += strStart.GetLength(); 
		strItemGroup.Delete(0, iPotion); 
		strStart = _T(""); 
		iPotion = strItemGroup.Find(strStart); 
		iPotion += strStart.GetLength(); 
		strItemGroup.Delete(0, iPotion); 
		iPotion = strItemGroup.Find(strEnd); 
		strItemGroup.Delete(iPotion, strItemGroup.GetLength() - iPotion); 
		CString strSperator = _T(""); 
		strItemGroup.TrimRight(); 
		strItemGroup = strItemGroup.Left(strItemGroup.GetLength() - strSperator.GetLength()); 
		for (int k = -strSperator.GetLength(); -1 != k; ) 
		{ 
			iPotion = k; 
			k = strItemGroup.Find(strSperator, k + strSperator.GetLength()); 
		} 
		strItemGroup = strItemGroup.Left(iPotion); 
		strEnd = _T("Links"); 
		iPotion = strItemGroup.Find(strEnd); 
		if (-1 != iPotion) strItemGroup.Delete(iPotion, strItemGroup.GetLength() - iPotion); 
		 
		CArray aryItem; 
		ExtractItem(strItemGroup, CString(_T(""); 
			strEnd   = _T(""); 
			iPotion = strItemFile.Find(strStart, 0); 
			iPotion += strStart.GetLength(); 
			strItemFile.Delete(0, iPotion); 
			iPotion = strItemFile.Find(strEnd); 
			strItemFile.Delete(iPotion, strItemFile.GetLength() - iPotion); 
 
			strItemFileTemp = strItemFile; 
			strItemFileTemp.MakeLower(); 
 
			CArray aryItemSource; 
			CString strFileType; 
			ExtractItem(strItemFileTemp, CString(_T("Format(_T("    %s 下载完毕!\n"), strCurSourceFileName); 
				::PostMessage(hWnd, WM_USER_DOWNSTATUS, (WPARAM)pStr, 0); 
 
			}//end for(l) 
			 
			//K 保存文章 
			strItemFile = _T("\n") + strItemFile; 
			bItemComplete = bItemComplete && SaveStr2File(strItemFile, m_strTargetDir + strCurDir + _T("\\\\") + strCurFileName + _T(".HTM")); 
			//K 更新进度 
			pStr = new CString; 
			pStr->Format(_T("  %s.htm 下载完毕!\n"), strCurFileName); 
			::PostMessage(hWnd, WM_USER_DOWNSTATUS, (WPARAM)pStr, 0); 
			 
			fileHist.WriteString(aryItem[iItems]); 
			strItemGroup.Replace(aryItem[iItems], strCurFileName + _T(".HTM")); 
		}//end for(iItem) 
 
		//K 保存分类索引文件		 
		strItemGroup = _T("\n") + strItemGroup; 
		SaveStr2File(strItemGroup, m_strTargetDir + strCurDir + _T("\\\\index.htm")); 
		//K 更新进度 
		pStr = new CString; 
		pStr->Format(_T("  index.htm 下载完毕!\n")); 
		::PostMessage(hWnd, WM_USER_DOWNSTATUS, (WPARAM)pStr, 0); 
		pStr = new CString; 
		pStr->Format(_T("%s 下载完毕!\n"), m_aryDownloadItemName[i]); 
		::PostMessage(hWnd, WM_USER_DOWNSTATUS, (WPARAM)pStr, 0); 
		pStr = new CString; 
		pStr->Format(_T("==================================================\n")); 
		::PostMessage(hWnd, WM_USER_DOWNSTATUS, (WPARAM)pStr, 0); 
		 
		fileHist.Close(); 
 
	}//K end for(i) 
	::PostMessage(hWnd, WM_USER_DOWNCOMPLETE, 0, 0); 
 
	return 0; 
} 
 
LRESULT CCodeProjectDlg::OnDownStatus(WPARAM wParam, LPARAM lParam) 
{ 
	CString *pStr; 
	pStr = (CString *)wParam; 
	 
	m_editStatus.SetSel(m_editStatus.GetWindowTextLength(), m_editStatus.GetWindowTextLength()); 
	m_editStatus.ReplaceSel(*pStr); 
	delete pStr; 
	return 0; 
} 
 
LRESULT CCodeProjectDlg::OnDownComplete(WPARAM, LPARAM) 
{ 
	AfxMessageBox(_T("下载完成!")); 
	m_bWorking = false; 
	m_btnOK.EnableWindow(); 
 
	return 0; 
} 
 
void CCodeProjectDlg::OnStaticWeb()  
{ 
	// TODO: Add your control notification handler code here 
	 
	//if (!m_bWorking) m_btnOK.EnableWindow(); 
	ShellExecute(NULL, _T("open"), _T("http://dalang.nease.net/fengnu.htm"), NULL, NULL, 2); 
	ShellExecute(NULL, _T("open"), _T("http://kjapan.sdedu.net/"), NULL, NULL, 2); 
} 
 
void CCodeProjectDlg::OnButton1()  
{ 
	// TODO: Add your control notification handler code here 
	CDlgExplain dlg; 
	dlg.DoModal(); 
} 
 
bool CCodeProjectDlg::ExtractItem(CString &strContant, CString &strStart, CString &strCondition, CString &strCurDir, void *pAry) 
{ 
	CArray *pArray; 
	pArray = (CArray *)pAry; 
 
	CString strEnd, strNetDir = _T("http://www.codeproject.com/") + strCurDir + _T("/"); 
	strNetDir.MakeLower(); 
	int iStart = 0, iEnd = 0; 
	iStart = strContant.Find(strStart, iStart); 
	for (; -1 != iStart; iStart = strContant.Find(strStart, iStart + strStart.GetLength())) 
	{ 
		bool bEnd = true; 
		for(int j = 0; bEnd; ++j) 
		{ 
			strEnd = strContant.Mid(iStart + strStart.GetLength() + j, 1); 
			bEnd = (strEnd == _T(" ")) || (strEnd == _T("=")); 
		} 
		if ((_T("\"") != strEnd) && (_T("'") != strEnd)) continue; 
 
		iEnd = strContant.Find(strEnd, iStart + strStart.GetLength() + j); 
		CString strTemp, strItem = strContant.Mid(iStart, iEnd - iStart); 
		strTemp = strItem; 
		strTemp.MakeLower(); 
		if (strTemp.Right(strCondition.GetLength()) == strCondition) 
		{ 
			strItem = strItem.Right(strItem.GetLength() - strStart.GetLength() - j); 
			strTemp = strItem.Left(strNetDir.GetLength()); 
			strTemp.MakeLower(); 
			if (_T("http://") == strTemp.Left(7)) 
			{ 
				if (strTemp.Left(strCurDir.GetLength()) == strCurDir) 
				{ 
					strItem = strItem.Right(strItem.GetLength() - strCurDir.GetLength()); 
					pArray->Add(strItem); 
				} 
			} 
			else 
			{ 
				if (_T("ftp://") != strTemp.Left(6)) 
					pArray->Add(strItem); 
			} 
		} 
	} 
	return true; 
} 








 

⌨️ 快捷键说明

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