摘要:
//关于文件(夹)操作,可以参考下SHFileOperation这个外壳函数,貌似可以显示进度条。以下没有使用SHFileOperation//删除一个文件夹下的所有内容void myDeleteDirectory(CString directory_path) { CFileFind finder; CString path; path.Format("%s/*.*",directory_path); BOOL bWorking = finder.FindFile(path); while(bWorking){ bWorking = finder.FindNextFile 阅读全文
摘要:
//如果涉及到大文件的遍历(大于4GB),可以将以下代码_finddata_t换成__finddata64_t,_findfirst换成_findfirst64,_findnext换成_findnext64void dfsFolder(CString dirPath){_finddata_t FileInfo;CString tmp=dirPath;if (tmp.Right(1) != "\\")tmp += "\\";CString strfind = tmp + "*";long Handle = _findfirst(strf 阅读全文
摘要:
//选择文件CFileDialog dlg(TRUE, 0, 0, OFN_HIDEREADONLY, "文本文件|*.txt|所有文件|*.*)||",0);if (dlg.DoModal()){CString filePath=dlg.GetPathName();CString fileNameWithNoExt=dlg.GetFileTitle();}//选择文件夹版本1void CMyTestDlg::OnBnClickedButton1(){TCHAR chPath[255]; //用来存储路径的字符串CString strPath;BROWSEINFO bInf 阅读全文
摘要:
COLORREF color=RGB(0,255,0);unsigned char r=GetRValue(color);unsigned char g=GetGValue(color);unsigned char b=GetBValue(color);-------------------------------------CColorDialog colorDialog;COLORREF color;if( colorDialog.DoModal() == IDOK ){ color = colorDialog.GetColor();}--------------------------- 阅读全文