{"id":1350,"date":"2014-09-16T22:20:43","date_gmt":"2014-09-16T14:20:43","guid":{"rendered":"http:\/\/www.youthtribe.com\/?p=1350"},"modified":"2014-09-16T22:20:43","modified_gmt":"2014-09-16T14:20:43","slug":"vcmfc%e9%80%92%e5%bd%92%e5%88%a0%e9%99%a4%e6%96%87%e4%bb%b6%e5%a4%b9%e5%8f%8a%e5%85%b6%e9%87%8c%e8%be%b9%e7%9a%84%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"http:\/\/www.youthtribe.com\/archives\/1350","title":{"rendered":"vc++[mfc]\u9012\u5f52\u5220\u9664\u6587\u4ef6\u5939\u53ca\u5176\u91cc\u8fb9\u7684\u6587\u4ef6"},"content":{"rendered":"

vc++[mfc]\u9012\u5f52\u5220\u9664\u6587\u4ef6\u5939\u53ca\u5176\u91cc\u8fb9\u7684\u6587\u4ef6<\/strong><\/p>\n

\r\nvoid DeleteDirectory(LPCTSTR path)\r\n{\r\n\tCFileFind findfile;\r\n\tCString str;\r\n\tstr=path;\r\n\tif(str.Right(1)!=\"\\\\\")\r\n\t\tstr.Format(\"%s\\\\*.*\",path);\r\n\telse\r\n\t\tstr.Format(\"%s*.*\",path);\r\n\tBOOL find=findfile.FindFile(str);\r\n\r\n\twhile(find)\r\n\t{\r\n\t\tfind=findfile.FindNextFile();\r\n\t\tif(findfile.IsDirectory())\r\n\t\t{\r\n\t\t\tif(!findfile.IsDots())\r\n\t\t\t{\r\n\r\n\t\t\t\tDeleteDirectory(findfile.GetFilePath());\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tDeleteFile(findfile.GetFilePath());\r\n\t\t}\r\n\t}\r\n\tfindfile.Close();\r\n\tif(!RemoveDirectory(path))\r\n\t{\r\n\t\tDWORD ret=::GetLastError();\r\n\t\tCString strerr;\r\n\t\tstrerr.Format(\"%d\",ret);\r\n\t\tMessageBox(strerr,\"\u9519\u8bef\u4ee3\u7801\",MB_OK);\r\n\t}\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

vc++[mfc]\u9012\u5f52\u5220\u9664\u6587\u4ef6\u5939\u53ca\u5176\u91cc\u8fb9\u7684\u6587\u4ef6 void DeleteDirectory(LPCTSTR path) { CFileFind findfile; CString str; str=path; if(str.Right(1)!=”\\\\”) str.Format(“%s\\\\*.*”,path); else str.Format(“%s*.*”,path); BOOL find=findfile.FindFile(str); while(find) { find=findfile.FindNextFile(); if(findfile.IsDirectory()) { if(!fin<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,219,9],"tags":[173,144,240],"_links":{"self":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1350"}],"collection":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/comments?post=1350"}],"version-history":[{"count":1,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1350\/revisions"}],"predecessor-version":[{"id":1351,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1350\/revisions\/1351"}],"wp:attachment":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/media?parent=1350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/categories?post=1350"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/tags?post=1350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}