Browse and select a folder, read the files in the folder and list them to ListBox. Read the text document content, process the document content, and save it to the new text document. The text document format is ANSI.
Void cfurtherconvertcutcodeview: onbnclickedbuttonbrowser () {cstring filepath; m_progressfile.setpos (0); m_listfiles.resetcontent (); tchar szpath [_ max_path]; browseinfo Bi; bi. hwndowner = NULL; bi. pidlroot = NULL; bi. lpsztitle = _ T ("file browsing"); bi. pszdisplayname = szpath; bi. ulflags = bif_returnonlyfsdirs; bi. lparam = NULL; bi. lpfn = NULL; lpitemidlist pitemidlist = shbrowseforfolder (& BI); If (pitemidlist) {If (pitemidlist, szpath) filepath = szpath; cfilefind finder; cstring strfilenname; bool bworking = finder. findfile (filepath + "\\*. din "); While (bworking) {bworking = finder. findnextfile (); strfilenname = (lpctstr) finder. getfilename (); // STR: Get a file name m_listfiles.addstring (strfilenname) ;}} else {filepath = "" ;}getdlgitem (idc_static_total) -> setwindowtext (_ T ("0"); getdlgitem (idc_static_running)-> setwindowtext (_ T ("0"); getdlgitem (idc_static_browse) -> setwindowtext (filepath);} void cfurtherconvertcutcodeview: onbnclickedbuttonrun () {// todo: add your control notification handler code herecstring strtotal; cstring strrunning; int K = 1; cstring strfilepath; // after adding a smooth image Program Saved directory cstring strpath; getdlgitem (idc_static_browse)-> getwindowtext (strfilepath); cstring strfilename; // find the selected project int isel = m_listfiles.getcount (); If (ISEL> 0) {strpath = strfilepath + _ T ("\ _ gcg261"); createdirectory (strpath, null);} m_progressfile.setpos (0); Int J = 0; for (INT I = 0; I <ISEL; I ++) {If (m_listfiles.getcheck (I) = 1) {J ++ ;}} strtotal. format (_ T ("% d"), J); getdlgitem (idc_static_total)-> setwindowtext (strtotal); m_pro Gressfile. setrange (0, J); m_progressfile.setstep (1); For (INT I = 0; I <ISEL; I ++) {If (m_listfiles.getcheck (I) = 1) {m_listfiles.gettext (I, strfilename); readcodefile (strfilepath + "\" + strfilename, strpath + "\" + strfilename); m_progressfile.stepit (); strrunning. format (_ T ("% d"), K ++); getdlgitem (idc_static_running)-> setwindowtext (strrunning) ;}} void cfurtherconvertcutcodeview: readcodefile (cstring strfilename, cstring Strwritefilename) {cstringlist listlines; string strt; cstring strline; cstring strpartline; cstdiofile writefile; bool isg01 = false; bool upload = false; bool isbreak = false; int I; cstdiofile myfile; myfile. open (strfilename, cfile: moderead);/* cfile mfile; mfile. open (strwritefilename, cfile: modecreate | cfile: modewrite); */cstdiofile * rfile = new cstdiofile (strwritefilename, cfile: modecreate | cfile: modewrite ); // While (myfile. readstring (strline) {/* carchive AR (& mfile, carchive: Store); */If (strline = "m07") {I = 0; while (isbreak! = True) {myfile. readstring (strline); I = I + 1; if (strline. Find (_ T ("g01 "))! =-1 & strline. Find (_ T ("X "))! =-1 & strline. Find (_ T ("Y "))! =-1) {isg01 = true; I = 1;} If (isg01 = true & I = 2) {If (strline. find (_ T ("g02")>-1 | strline. find (_ T ("g03")>-1) {isaddg261 = true; isbreak = true ;}} if (strline. find (_ T ("m08 "))! =-1) {isbreak = true;} listlines. addtail (strline);} // end whileisbreak = false; If (isaddg261 = true) {strline = "g261 \ nm07";} else {strline = "m07 ";}} // end if m07if (strline. find (_ T ("m08 "))! =-1 & isaddg261 = true) {strline = "m08 \ ng260"; isaddg261 = false;} If (strline. find (_ T ("# trafo on "))! =-1) {strline = "# trafo on \ n # contour mode [Dev path_dev = 0.2 relevant_path = 0.1]";} rfile-> writestring (strline. getbuffer (); rfile-> writestring (_ T ("\ n"); position rpos; rpos = listlines. getheadposition (); While (rpos! = NULL) {strpartline = listlines. getnext (rpos); rfile-> writestring (strpartline. getbuffer (); rfile-> writestring (_ T ("\ n");} listlines. removeall ();} // end whilerfile-> close (); Delete rfile;} void cfurtherconvertcutcodeview: writcodefile (cstring strline) {// * cstring // cstdiofile myfile ;} void cfurtherconvertcutcodeview: onclickedcheckselectall () {// todo: add your control notification handler code hereif (bst_ch Ecked =! Isdlgbuttonchecked (idc_check_selectall) {selectchecklist (0);} else {selectchecklist (1) ;}} void progress: selectchecklist (INT icheck) {int ISEL = m_listfiles.getcount (); for (INT I = 0; I <ISEL; I ++) {m_listfiles.setcheck (I, icheck );}}