{"id":1301,"date":"2011-01-27T09:57:44","date_gmt":"2011-01-27T01:57:44","guid":{"rendered":"https:\/\/www.highflybird.com\/blog\/?p=242"},"modified":"2020-02-29T22:59:07","modified_gmt":"2020-02-29T14:59:07","slug":"%e5%9e%83%e5%9c%be%e6%96%87%e4%bb%b6%e6%b8%85%e7%90%86%e5%b7%a5%e5%85%b7","status":"publish","type":"post","link":"https:\/\/www.highflybird.com\/blog\/?p=1301","title":{"rendered":"\u5783\u573e\u6587\u4ef6\u6e05\u7406\u5de5\u5177"},"content":{"rendered":"<p>\u5728\u5de5\u4f5c\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u6e05\u7406\u4e00\u4e9b\u5728\u7a0b\u5e8f\u8fc7\u7a0b\u4e2d\u4ea7\u751f\u7684\u5783\u573e\u6216\u8005\u65e0\u9700\u4fdd\u7559\u6587\u4ef6\uff0c\u4f46\u662f\u56e0\u4e3a\u4e0d\u77e5\u60c5\u6216\u8005\u7ecf\u5e38\u5fd8\u8bb0\u7684\u7f18\u6545\uff0c\u8fd9\u4e9b\u6587\u4ef6\u4fbf\u79ef\u7d2f\u8d77\u6765\uff0c\u5206\u5e03\u5728\u5404\u4e2a\u76ee\u5f55\u4e2d\uff0c\u96be\u4e8e\u67e5\u627e\u548c\u5220\u9664\u3002\u7279\u522b\u662f\u5bf9\u4e8eCAD\u4f5c\u56fe\u7684\u4eba\u6765\u8bf4\uff0c\u6709\u65f6\u5019\u5f62\u6210\u4e00\u4e9b.dwl, .plt, .err, .log, .ac$, .tmp\u7b49\u4e4b\u7c7b\u7684\u6587\u4ef6\uff0c\u957f\u671f\u4ee5\u6765\uff0c\u65e2\u4e0d\u7f8e\u89c2\uff0c\u53c8\u6d6a\u8d39\u7a7a\u95f4\uff0c\u7684\u786e\u6709\u5fc5\u8981\u6e05\u7406\u4e00\u4e0b\u3002\u800c\u4e14\u4e0b\u9762\u8fd9\u4e2a\u7a0b\u5e8f\u53ef\u4ee5\u5e2e\u4f60\u8fbe\u5230\u76ee\u7684\u3002\u7f51\u4e0a\u6709\u8fd9\u6837\u7c7b\u4f3c\u7684\u7a0b\u5e8f\uff0c\u4f46\u53ef\u80fd\u6bd4\u8f83\u5e9e\u6742\uff0c\u4e0d\u4f1a\u50cf\u8fd9\u6837\u9488\u5bf9\u7279\u522b\u76ee\u7684\u3002<br \/>\n<!--more--><\/p>\n<p>\u7a0b\u5e8f\u622a\u56fe\uff1a<\/p>\n<p><a href=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2014\/08\/vb-cadcleaner.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-245\" src=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2014\/08\/vb-cadcleaner-300x239.jpg\" alt=\"vb-cadcleaner\" width=\"300\" height=\"239\"><\/a><\/p>\n<p><a href=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2014\/08\/CADCleaner.zip\">CADCleaner<\/a><\/p>\n<p>\u5f88\u4e45\u4e4b\u524d\u6211\u5c31\u5199\u4e86\u8fd9\u4e2a\u7a0b\u5e8f\uff0c\u5f00\u59cb\u65f6\u662f\u7528VLISP\u7a0b\u5e8f\u5199\u7684\uff0c\u540e\u6765\u6211\u5728\u5b66\u4e60VB\u7684\u8fc7\u7a0b\u4e2d\uff0c\u53c8\u628a\u7a0b\u5e8f\u518d\u6b21\u5199\u4e86\u4e00\u904d\uff0c\u6700\u540e\u6211\u7528VC++\u91cd\u5199\u3002\u6240\u4ee5\u8fd9\u4e2a\u7a0b\u5e8f\u6709\u4e09\u79cd\u7248\u672c\u7684\u3002\u8fd9\u91cc\u6211\u5148\u53d1\u5e03VB\u8bed\u8a00\u7684\u3002<\/p>\n<p>\u5173\u4e8e\u8fd9\u4e2a\u7a0b\u5e8f\u7684\u6e90\u7801\u6211\u5c31\u4e0d\u53d1\u5e03\u4e86\uff0c\u9644\u4ef6\u4ec5\u4ec5\u5305\u542b\u7a0b\u5e8f\u3002\u8fd9\u91cc\u8d34\u51fa\u4e00\u6bb5\u5173\u952e\u4ee3\u7801\uff0c\u5c31\u662f\u7528API \u67e5\u627e\u7279\u5b9a\u6587\u4ef6\u7684\u4ee3\u7801\uff1a<\/p>\n<pre lang=\"vb\" line=\"1\" escaped=\"true\">'**********************************************************************************************************************\n'\u67e5\u627e\u51fd\u6570\nPublic Function FindFilesAPI(path As String, SearchStr As Variant, FileCount As Long, DirCount As Long) As Double\n    Dim FileName    As String           '\u6587\u4ef6\u540d\n    Dim Extension   As String           '\u6587\u4ef6\u540e\u7f00\n    Dim DirName     As String           '\u5b50\u76ee\u5f55\u540d\n    Dim dirNames()  As String           '\u76ee\u5f55\u6570\u7ec4\n    Dim nDir        As Long             '\u5f53\u524d\u8def\u5f84\u7684\u76ee\u5f55\u6570\n    Dim i           As Long             '\u5faa\u73af\u8ba1\u6570\u5668\u53d8\u91cf\n    Dim hSearch     As Long             '\u641c\u7d22\u53e5\u67c4\u53d8\u91cf\n    Dim WFD         As WIN32_FIND_DATA\n    Dim Cont        As Long\n    \n    If Right(path, 1) &lt;&gt; chr(92) Then path = path &amp; chr(92)\n    '\u641c\u7d22\u5b50\u76ee\u5f55\n    nDir = 0\n    ReDim dirNames(nDir)\n    Cont = True\n    hSearch = FindFirstFile(path &amp; \"*\", WFD)\n    If hSearch &lt;&gt; INVALID_HANDLE_VALUE Then\n        Do While Cont\n            FileName = StripNulls(WFD.cFileName)\n            If (FileName &lt;&gt; \".\") And (FileName &lt;&gt; \"..\") Then\n                '\u904d\u5386\u76ee\u5f55\u5e76\u7d2f\u8ba1\u6587\u4ef6\u603b\u6570\n                If GetFileAttributes(path &amp; FileName) And FILE_ATTRIBUTE_DIRECTORY Then\n                    dirNames(nDir) = FileName\n                    DirCount = DirCount + 1\n                    nDir = nDir + 1\n                    ReDim Preserve dirNames(nDir)\n                Else\n                    If isCheckAll Or UserForm1.ZERO.Value And WFD.nFileSizeLow = 0 Then\n                        If isCheckAll Then\n                            FindFilesAPI = FindFilesAPI + (WFD.nFileSizeHigh * MAXDWORD) + WFD.nFileSizeLow\n                        End If\n                        FileCount = FileCount + 1\n                        UserForm1.List1.AddItem path &amp; FileName\n                    Else\n                        Extension = Mid(FileName, InStrRev(FileName, \".\") + 1)\n                        If CheckType(Extension, SearchStr) Then\n                            FindFilesAPI = FindFilesAPI + (WFD.nFileSizeHigh * MAXDWORD) + WFD.nFileSizeLow\n                            FileCount = FileCount + 1\n                            UserForm1.List1.AddItem path &amp; FileName\n                            SendMessage LHwnd, WM_VSCROLL, SB_BOTTOM, 0&amp;\n                        End If\n                    End If\n                End If\n            End If\n            Cont = FindNextFile(hSearch, WFD)         '\u83b7\u53d6\u4e0b\u4e00\u4e2a\u6587\u4ef6\u6216\u8005\u6587\u4ef6\u5939\n        Loop\n        Cont = FindClose(hSearch)\n    End If\n    '\u5982\u679c\u5b50\u76ee\u5f55\u5b58\u5728\u5219\u904d\u5386\u4e4b\n    If nDir &gt; 0 And UserForm1.INC.Value Then\n        For i = 0 To nDir - 1\n            FindFilesAPI = FindFilesAPI + FindFilesAPI(path &amp; dirNames(i) &amp; chr(92), SearchStr, FileCount, DirCount)\n        Next i\n    End If\nEnd Function<\/pre>\n<p>VC\u7248\u672c\u7684\uff1a<\/p>\n<pre lang=\"cpp\" line=\"1\" escaped=\"true\">int CCADCleanerDlg::Search(CString PathName)\n{\n\tCString FileName;\n\tHANDLE hScan=NULL;\n\tWIN32_FIND_DATAW FindFileData;\n\tif (PathName.Right(1) != (chr(92)))\n\t{\n\t\thScan = FindFirstFile(PathName +_T(\"*\"),&amp;FindFileData);\n\t}\n\telse\n\t{\n\t\thScan = FindFirstFile(PathName +_T(\"*\"),&amp;FindFileData);\n\t}\n\t\n\tif ( hScan != INVALID_HANDLE_VALUE)\n\t{\n\t\tBOOL cont = TRUE;\n\t\twhile (cont)\n\t\t{\n\t\t\tFileName =  FindFileData.cFileName;\n\t\t\tif (FileName!=_T(\".\") &amp;&amp; FileName!=_T(\"..\"))\n\t\t\t{\n\t\t\t\tif (FindFileData.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY)\n\t\t\t\t{\n\t\t\t\t\tDirCount++;\n\t\t\t\t\tSearch(PathName+FileName+chr(92));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (Check(FileName,FindFileData.nFileSizeLow,FindFileData.nFileSizeHigh))\n\t\t\t\t\t{\n\t\t\t\t\t\t\/\/m_strInfo = (PathName+FileName);\n\t\t\t\t\t\tm_list.AddString(PathName+FileName);\n\t\t\t\t\t\t\/\/m_Info.SetWindowText(m_strInfo);\n\t\t\t\t\t\t\/\/m_list.SendMessage(LB_ADDSTRING,NULL,(LPARAM)(FileName.GetBuffer()));\n\t\t\t\t\t\t\/\/SendMessage(m_listWnd,LB_ADDSTRING,NULL,(LPARAM)(FileName.GetBuffer()));\n\t\t\t\t\t\t\/\/m_list.SendMessage(WM_VSCROLL,SB_BOTTOM,NULL);\n\t\t\t\t\t\tFileCount++;\n\t\t\t\t\t\tif (FindFileData.nFileSizeHigh)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tTotalSize += (FindFileData.nFileSizeLow + FindFileData.nFileSizeHigh * FOUR_GB);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tTotalSize += FindFileData.nFileSizeLow;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\n\t\t\tcont = FindNextFile(hScan,&amp;FindFileData);\n\t\t}\n\t\tFindClose(hScan);\n\t\treturn TRUE;\n\t}\n\telse\n\t{\n\t\treturn ERROR;\n\t}\n}<\/pre>\n<p>\u622a\u56fe\uff1a<br \/>\n<a href=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2014\/08\/cadcleanerVC.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2014\/08\/cadcleanerVC-300x234.jpg\" alt=\"cadcleaner(VC)\" width=\"300\" height=\"234\" class=\"alignnone size-medium wp-image-251\"><\/a><br \/>\n<a href=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2014\/08\/CADCleanerVC.zip\">CADCleaner(VC)<\/a><br \/>\n\u5f53\u7136\u662f\u7528C\u8bed\u8a00\u7f16\u5199\u7684\u5feb\u4e9b\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5de5\u4f5c\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u6e05\u7406\u4e00\u4e9b\u5728\u7a0b\u5e8f\u8fc7\u7a0b\u4e2d\u4ea7\u751f\u7684\u5783\u573e\u6216\u8005\u65e0\u9700\u4fdd\u7559\u6587\u4ef6\uff0c\u4f46\u662f\u56e0\u4e3a\u4e0d\u77e5\u60c5\u6216\u8005\u7ecf\u5e38\u5fd8\u8bb0\u7684\u7f18\u6545\uff0c\u8fd9\u4e9b\u6587\u4ef6\u4fbf<\/p>\n<p class=\"more-link\"><a href=\"https:\/\/www.highflybird.com\/blog\/?p=1301\" class=\"themebutton2\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[9],"tags":[23],"class_list":["post-1301","post","type-post","status-publish","format-standard","hentry","category-programming","tag-23"],"_links":{"self":[{"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1301","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1301"}],"version-history":[{"count":0,"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1301\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}