




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃
2、袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇
3、蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂
4、薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆
5、螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀
6、蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞
7、袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞薅肂莄蒅襖肁肄羋螀肀芆蒃螆肀荿莆螞聿肈薂薈肈膀蒞袆?wù)仄M薀螂膆蒞莃蚈膅肅薈薄膄膇莁羃膄荿薇衿膃蒂葿螅膂膁蚅蟻螈芄蒈薇螈莆蚃袆螇肆蒆螂袆膈蟻蚇裊芀蒄薃襖蒃芇羂袃膂薃袈袂芅蒞螄袂莇薁蝕袁肆莄薆袀腿蕿裊罿芁莂螁羈莃薇蚇羇膃莀蚃羆芅蚆蕿羆莈葿袇羅肇蚄螃羄膀蕆蠆肅節(jié)螞 計算機(jī)程序設(shè)計實(shí)踐課程設(shè)計報告班 級 _計算機(jī)0801班 _學(xué) 號 _080405008 _姓 名 _秦勇旭 指導(dǎo)教師 _劉嘉敏 _
8、2010 年 6月 8日1課題要求及目標(biāo)基本要求1,實(shí)現(xiàn)計算機(jī)的各個驅(qū)動器中的文件的分類,類別有:文檔文件(doc),文本文檔(txt),位圖文檔(bmp,jpg),音頻文件(mp3);2,現(xiàn)實(shí)每類文件的屬性,即文件名(filename),存放位置(address),文件大小(filesize)和創(chuàng)建時間(createtime);3,實(shí)現(xiàn)文件的重命名(rename),拷貝(copy),刪除(delete)和移動(move)操作;4,實(shí)現(xiàn)瀏覽文本文件,現(xiàn)實(shí)位圖文件和試聽音頻文件。開發(fā)目標(biāo)(已完成)1,實(shí)現(xiàn)計算機(jī)的各個驅(qū)動器中的文件的分類,類別有:文檔文件(doc),文本文檔(txt),位圖文檔(
9、bmp,jpg),音頻文件(mp3);2,現(xiàn)實(shí)每類文件的屬性,即文件名(filename),存放位置(address),文件大小(filesize)和創(chuàng)建時間(createtime);3,實(shí)現(xiàn)文件的重命名(rename),拷貝(copy),刪除(delete)和移動(move)操作;4,實(shí)現(xiàn)瀏覽文本文件,現(xiàn)實(shí)位圖文件和試聽音頻文件。2用例分析用例模型用例描述:用戶對系統(tǒng)文件進(jìn)行分盤分類查找,實(shí)現(xiàn)文件分類查找后的打開播放功能用例1名稱用戶對程序的應(yīng)用用例標(biāo)識號1事件說明:(包括基本、其他、異常事件處理過程)簡述: 該用例允許用戶對系統(tǒng)文件的分類查找與使用參與者:用戶;基本事件:程序運(yùn)行后,用戶是
10、用左視圖的tree試圖進(jìn)行事件的觸發(fā),單擊某一類型的文件,將在右側(cè)的list視圖中顯示該盤下該文件類型的所有文件用戶可以對文件進(jìn)行處理. 異常處理:關(guān)閉。3系統(tǒng)結(jié)構(gòu)設(shè)計與實(shí)現(xiàn)類圖:類名cexplorerdlg, cexplorerapp類的作用實(shí)現(xiàn)文件的分類分盤查找,對界面進(jìn)行初始化類定義:class cexplorerdlg : public cdialog/ constructionpublic:cexplorerdlg(cwnd* pparent = null);/ standard constructor void inittree();char * substr(const char
11、 *s,int sublength, int length);void findfiledoc(char* rootdir);void findfiletxt(char* rootdir);void findfilemp3(char* rootdir);void findfilepic(char* rootdir);/ dialog data/afx_data(cexplorerdlg)enum idd = idd_explorer_dialog ;clistctrlm_list;ctreectrlm_tree;/afx_data/ classwizard generated virtual
12、function overrides/afx_virtual(cexplorerdlg)protected:virtual void dodataexchange(cdataexchange* pdx);/ ddx/ddv support/afx_virtual/ implementationprotected:hicon m_hicon;/ generated message map functions/afx_msg(cexplorerdlg)virtual bool oninitdialog();afx_msg void onsyscommand(uint nid, lparam lpa
13、ram);afx_msg void onpaint();afx_msg hcursor onquerydragicon();afx_msg void onclicktree1(nmhdr* pnmhdr, lresult* presult);afx_msg void onselchangedtree1(nmhdr* pnmhdr, lresult* presult);afx_msg void ondblclklist1(nmhdr* pnmhdr, lresult* presult);/afx_msgdeclare_message_map();類的實(shí)現(xiàn)代碼(本人實(shí)現(xiàn)的部分的代碼):void c
14、explorerdlg:inittree()htreeitem h_firstroot; htreeitem h_secondroot4; h_firstroot=m_tree.insertitem(本地計算機(jī),0,1);cstring strsecond4,strthird;h_secondroot0=m_tree.insertitem(c,0,1,h_firstroot);h_secondroot1=m_tree.insertitem(d,0,2,h_firstroot);h_secondroot2=m_tree.insertitem(e,0,3,h_firstroot);for(int
15、i=0;i4;i+) m_tree.insertitem(文檔文件,0,1,h_secondrooti);m_tree.insertitem(文本文件,0,2,h_secondrooti);m_tree.insertitem(音頻文件,0,3,h_secondrooti);m_tree.insertitem(位圖文件,0,4,h_secondrooti);樹控件添加節(jié)點(diǎn) bool cexplorerdlg:oninitdialog()cdialog:oninitdialog();/ add about. menu item to system menu./ idm_aboutbox must
16、be in the system command range.assert(idm_aboutbox & 0xfff0) = idm_aboutbox);assert(idm_aboutbox appendmenu(mf_separator);psysmenu-appendmenu(mf_string, idm_aboutbox, straboutmenu);/ set the icon for this dialog. the framework does this automatically/ when the applications main window is not a dialo
17、gseticon(m_hicon, true);/ set big iconseticon(m_hicon, false);/ set small icon/ todo: add extra initialization herem_list.setextendedstyle(lvs_ex_flatsb|lvs_ex_fullrowselect|lvs_ex_headerdragdrop|lvs_ex_oneclickactivate|lvs_ex_gridlines);m_list.insertcolumn(0,filename,lvcfmt_left,120,0);m_list.inser
18、tcolumn(1,address,lvcfmt_left,120,2);m_list.insertcolumn(2,filesize,lvcfmt_left,120,3);m_list.insertcolumn(3,createtime,lvcfmt_left,120,4);初始化list控件,添加文件屬性inittree();return true; / return true unless you set the focus to a control4系統(tǒng)行為設(shè)計與實(shí)現(xiàn) (與本人相關(guān)內(nèi)容)界面導(dǎo)航關(guān)系界面中主要消息響應(yīng)函數(shù)的實(shí)現(xiàn)(本人實(shí)現(xiàn)的部分的函數(shù))函數(shù)名findfiledoc fin
19、dfilemp3findfilepic findfiletxt函數(shù)參數(shù)char *rootdir函數(shù)返回類型void函數(shù)實(shí)現(xiàn)代碼:void cexplorerdlg:findfiledoc(char *rootdir)char fnamemax_path; zeromemory(fname, max_path); win32_find_data fd; zeromemory(&fd, sizeof(win32_find_data); handle hsearch; char filepathname256; char tmppath256; zeromemory(filepathname, 2
20、56); zeromemory(tmppath, 256); strcpy(filepathname, rootdir); bool bsearchfinished = false; if( filepathnamestrlen(filepathname) -1 != ) strcat(filepathname, ); strcat(filepathname, *.*); hsearch = findfirstfile(filepathname, &fd); if( (fd.dwfileattributes & file_attribute_directory) & strcmp(fd.cfi
21、lename, .) & strcmp(fd.cfilename, .) ) strcpy(tmppath, rootdir); strcat(tmppath,); strcat(tmppath, fd.cfilename); findfiledoc(tmppath); 循環(huán)調(diào)用 else if( strcmp(fd.cfilename, .) & strcmp(fd.cfilename, .) ) sprintf(fname, %-50.50s, fd.cfilename); printf(%sn , fname); while( !bsearchfinished ) if( findnex
22、tfile(hsearch, &fd) ) if( (fd.dwfileattributes & file_attribute_directory) & strcmp(fd.cfilename, .) & strcmp(fd.cfilename, .) ) strcpy(tmppath, rootdir); strcat(tmppath,); strcat(tmppath, fd.cfilename); findfiledoc(tmppath); 循環(huán)調(diào)用 else if( strcmp(fd.cfilename, .) & strcmp(fd.cfilename, .) ) int n; n
23、=strlen(fd.cfilename);char *sub;sub=substr(fd.cfilename,4,n); if(!strcmp(sub,.doc)文件類型設(shè)定 sprintf(fname, %-50.50s, fd.cfilename); cstring sr,strtime,strlast;sr.format(%d,fd.nfilesizelow/1024);ctime strtime=fd.ftcreationtime;ctime strlast=fd.ftlastwritetime;strtime=strtime.format( %y-%m-%d %h:%m:%s );
24、strlast=strlast.format( %y-%m-%d %h:%m:%s ); m_list.insertitem(0,); m_list.setitemtext(0,0,fname);m_list.setitemtext(0,1,filepathname);m_list.setitemtext(0,2,sr+k);m_list.setitemtext(0,3,strtime);m_list.setitemtext(0,4,strlast); else if( getlasterror() = error_no_more_files ) bsearchfinished = true;
25、 else bsearchfinished = true; findclose(hsearch);void cexplorerdlg:findfilemp3(char *rootdir)char fnamemax_path; zeromemory(fname, max_path); win32_find_data fd; zeromemory(&fd, sizeof(win32_find_data); handle hsearch; char filepathname256; char tmppath256; zeromemory(filepathname, 256); zeromemory(
26、tmppath, 256); strcpy(filepathname, rootdir); bool bsearchfinished = false; if( filepathnamestrlen(filepathname) -1 != ) strcat(filepathname, ); strcat(filepathname, *.*); hsearch = findfirstfile(filepathname, &fd); /is directory if( (fd.dwfileattributes & file_attribute_directory) & strcmp(fd.cfile
27、name, .) & strcmp(fd.cfilename, .) ) strcpy(tmppath, rootdir); strcat(tmppath,); strcat(tmppath, fd.cfilename); findfilemp3(tmppath); 循環(huán)調(diào)用 else if( strcmp(fd.cfilename, .) & strcmp(fd.cfilename, .) ) sprintf(fname, %-50.50s, fd.cfilename); printf(%sn , fname); while( !bsearchfinished ) if( findnextf
28、ile(hsearch, &fd) ) if( (fd.dwfileattributes & file_attribute_directory) & strcmp(fd.cfilename, .) & strcmp(fd.cfilename, .) ) strcpy(tmppath, rootdir); strcat(tmppath,); strcat(tmppath, fd.cfilename); findfilemp3(tmppath); 循環(huán)調(diào)用 else if( strcmp(fd.cfilename, .) & strcmp(fd.cfilename, .) ) int n; n=s
29、trlen(fd.cfilename);char *sub;sub=substr(fd.cfilename,4,n); if(!strcmp(sub,.mp3)文件類型設(shè)定 sprintf(fname, %-50.50s, fd.cfilename); cstring sr,strtime,strlast;sr.format(%d,fd.nfilesizelow/1024);ctime strtime=fd.ftcreationtime;ctime strlast=fd.ftlastwritetime;strtime=strtime.format( %y-%m-%d %h:%m:%s );st
30、rlast=strlast.format( %y-%m-%d %h:%m:%s ); m_list.insertitem(0,); m_list.setitemtext(0,0,fname);m_list.setitemtext(0,1,filepathname);m_list.setitemtext(0,2,sr+k);m_list.setitemtext(0,3,strtime);m_list.setitemtext(0,4,strlast); else if( getlasterror() = error_no_more_files ) bsearchfinished = true; e
31、lse bsearchfinished = true; /terminate search findclose(hsearch);/void cexplorerdlg:findfilepic(char *rootdir)char fnamemax_path; zeromemory(fname, max_path); win32_find_data fd; zeromemory(&fd, sizeof(win32_find_data); handle hsearch; char filepathname256; char tmppath256; zeromemory(filepathname,
32、256); zeromemory(tmppath, 256); strcpy(filepathname, rootdir); bool bsearchfinished = false; if( filepathnamestrlen(filepathname) -1 != ) strcat(filepathname, ); strcat(filepathname, *.*); hsearch = findfirstfile(filepathname, &fd); if( (fd.dwfileattributes & file_attribute_directory) & strcmp(fd.cf
33、ilename, .) & strcmp(fd.cfilename, .) ) strcpy(tmppath, rootdir); strcat(tmppath,); strcat(tmppath, fd.cfilename); findfilepic(tmppath); 循環(huán)調(diào)用 else if( strcmp(fd.cfilename, .) & strcmp(fd.cfilename, .) ) sprintf(fname, %-50.50s, fd.cfilename); printf(%sn , fname); while( !bsearchfinished ) if( findne
34、xtfile(hsearch, &fd) ) if( (fd.dwfileattributes & file_attribute_directory) & strcmp(fd.cfilename, .) & strcmp(fd.cfilename, .) ) strcpy(tmppath, rootdir); strcat(tmppath,); strcat(tmppath, fd.cfilename); findfilepic(tmppath); 循環(huán)調(diào)用 else if( strcmp(fd.cfilename, .) & strcmp(fd.cfilename, .) ) int n;
35、n=strlen(fd.cfilename);char *sub;sub=substr(fd.cfilename,4,n); if(!strcmp(sub,.jpg)|!strcmp(sub,.bmp) sprintf(fname, %-50.50s, fd.cfilename); cstring sr,strtime,strlast;sr.format(%d,fd.nfilesizelow/1024);ctime strtime=fd.ftcreationtime;ctime strlast=fd.ftlastwritetime;strtime=strtime.format( %y-%m-%
36、d %h:%m:%s );strlast=strlast.format( %y-%m-%d %h:%m:%s ); m_list.insertitem(0,); m_list.setitemtext(0,0,fname);m_list.setitemtext(0,1,filepathname);m_list.setitemtext(0,2,sr+k);m_list.setitemtext(0,3,strtime);m_list.setitemtext(0,4,strlast); else if( getlasterror() = error_no_more_files ) bsearchfin
37、ished = true; else bsearchfinished = true; findclose(hsearch);void cexplorerdlg:findfiletxt(char *rootdir)char fnamemax_path; zeromemory(fname, max_path); win32_find_data fd; zeromemory(&fd, sizeof(win32_find_data); handle hsearch; char filepathname256; char tmppath256; zeromemory(filepathname, 256)
38、; zeromemory(tmppath, 256); strcpy(filepathname, rootdir); bool bsearchfinished = false; if( filepathnamestrlen(filepathname) -1 != ) strcat(filepathname, ); strcat(filepathname, *.*); hsearch = findfirstfile(filepathname, &fd); if( (fd.dwfileattributes & file_attribute_directory) & strcmp(fd.cfilen
39、ame, .) & strcmp(fd.cfilename, .) ) strcpy(tmppath, rootdir); strcat(tmppath,); strcat(tmppath, fd.cfilename); findfiletxt(tmppath); 循環(huán)調(diào)用 else if( strcmp(fd.cfilename, .) & strcmp(fd.cfilename, .) ) sprintf(fname, %-50.50s, fd.cfilename); printf(%sn , fname); while( !bsearchfinished ) if( findnextfi
40、le(hsearch, &fd) ) if( (fd.dwfileattributes & file_attribute_directory) & strcmp(fd.cfilename, .) & strcmp(fd.cfilename, .) ) strcpy(tmppath, rootdir); strcat(tmppath,); strcat(tmppath, fd.cfilename); findfiletxt(tmppath);循環(huán)調(diào)用 else if( strcmp(fd.cfilename, .) & strcmp(fd.cfilename, .) ) int n; n=str
41、len(fd.cfilename);char *sub;sub=substr(fd.cfilename,4,n); if(!strcmp(sub,.txt)文件類型設(shè)定 sprintf(fname, %-50.50s, fd.cfilename); cstring sr,strtime,strlast;sr.format(%d,fd.nfilesizelow/1024);ctime strtime=fd.ftcreationtime;ctime strlast=fd.ftlastwritetime;strtime=strtime.format( %y-%m-%d %h:%m:%s );strl
42、ast=strlast.format( %y-%m-%d %h:%m:%s ); m_list.insertitem(0,); m_list.setitemtext(0,0,fname);m_list.setitemtext(0,1,filepathname);m_list.setitemtext(0,2,sr+k);m_list.setitemtext(0,3,strtime);m_list.setitemtext(0,4,strlast); else if( getlasterror() = error_no_more_files ) bsearchfinished = true; els
43、e bsearchfinished = true; findclose(hsearch);函數(shù)名:onselchangedtree1函數(shù)參數(shù):nmhdr* pnmhdr, lresult* presult函數(shù)返回類型:void函數(shù)的代碼實(shí)現(xiàn):void cexplorerdlg:onselchangedtree1(nmhdr* pnmhdr, lresult* presult) nm_treeview* pnmtreeview = (nm_treeview*)pnmhdr;/ todo: add your control notification handler code herehtreeit
44、em hselecteditem=m_tree.getselecteditem(); htreeitem hparent=m_tree.getparentitem(hselecteditem);cstring str1=m_tree.getitemtext(hparent);cstring m_style; m_style=m_tree.getitemtext(hselecteditem);/文檔文件查找 if(m_style=文檔文件&str1=d) m_list.deleteallitems(); findfiledoc(d:); if(m_style=文檔文件&str1=c) m_list.deleteallitems(); findfiledoc(c:); /文本文件查找 if(m_style=文本文件&str1=c) m_list.deleteallitems(); findfiletxt(c:); if(m_style=文本文件&str1=d) m_list.deleteallitems(); findfiletxt(d:); /音頻文件查找 if(m_style=音頻文件&str1=d) m_list.deleteallit
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 印刷服務(wù)合同
- 生產(chǎn)車間承包合同協(xié)議
- 河北化工醫(yī)藥職業(yè)技術(shù)學(xué)院《中學(xué)生物課堂教學(xué)技能訓(xùn)練》2023-2024學(xué)年第二學(xué)期期末試卷
- 廣州華立科技職業(yè)學(xué)院《數(shù)據(jù)挖掘與決策管理》2023-2024學(xué)年第二學(xué)期期末試卷
- 寧波衛(wèi)生職業(yè)技術(shù)學(xué)院《界面化學(xué)》2023-2024學(xué)年第二學(xué)期期末試卷
- 宜春學(xué)院《需求工程》2023-2024學(xué)年第二學(xué)期期末試卷
- 宿州職業(yè)技術(shù)學(xué)院《水質(zhì)工程學(xué)實(shí)驗(yàn)》2023-2024學(xué)年第二學(xué)期期末試卷
- 鄭州經(jīng)貿(mào)學(xué)院《小學(xué)教學(xué)研究》2023-2024學(xué)年第二學(xué)期期末試卷
- 江西管理職業(yè)學(xué)院《活動策劃與管理》2023-2024學(xué)年第二學(xué)期期末試卷
- 電子科技大學(xué)中山學(xué)院《信息技術(shù)基礎(chǔ)及應(yīng)用》2023-2024學(xué)年第二學(xué)期期末試卷
- 中國古代服飾文化135張課件
- 《道德與法治》五下第一單元《我們一家人》教案
- 拔罐技術(shù)操作流程圖
- 真空泵日常操作標(biāo)準(zhǔn)作業(yè)指導(dǎo)書
- 鋼筋保護(hù)層厚度試驗(yàn)檢測記錄表
- 南寧市海綿城市規(guī)劃設(shè)計導(dǎo)則-圖文課件
- 階段1 古代中華文明的起源與奠基-先秦 課時1 先秦時期的社會經(jīng)濟(jì) 課件-2022屆高三歷史一輪復(fù)習(xí)
- 電焊工安全教育培訓(xùn)課件
- 公共關(guān)系理論與實(shí)務(wù)ppt課件(完整版)
- 外研版五年級下冊小學(xué)英語全冊教學(xué)課件PPT
- 中國石油大學(xué)(華東)-朱超-答辯通用PPT模板
評論
0/150
提交評論