كيف يمكنني البحث عن الملفات في كامل الهاردسك بدون أستخدام API أو أستخدامها إذا كان في إستخدامها إختصار ملحوظ للكود أرجو أن يكون المثال مدعوم بالشرح
البحث عن الملفات في كامل الهاردسك
مغلق
اخي محتار هذا الكود يقوم بالبحث في المحرك الاقراص c:
Private Sub Command1_Click()
البحث_داخل "c:"
End Sub
Public Function البحث_داخل(strStartingPath As String) As String
Dim strReturnDir As String
Dim strFoundFile As String
Dim strAllFolders As String
Dim strTestPath As String
Dim iI As Integer
If Right(strStartingPath, 1) <> "" Then strStartingPath = strStartingPath + ""
strStartingPath = UCase(strStartingPath)
strFoundFile = Dir(strStartingPath, vbNormal + vbHidden + vbArchive + vbSystem + vbReadOnly)
strReturnDir = Dir(strStartingPath + "*.*", vbDirectory)
Label1.Caption = strStartingPath
DoEvents
Do While strReturnDir <> ""
If GetAttr(strStartingPath + strReturnDir) = vbDirectory Then
If strReturnDir <> "." And strReturnDir <> ".." Then
strAllFolders = strAllFolders + strReturnDir + ";"
End If
End If
strReturnDir = Dir
Loop
Do
iI = iI + 1
If Mid(strAllFolders, iI, 1) = ";" Then
strTestPath = Left(strAllFolders, iI - 1)
If strTestPath <> "" Then
strFoundFile = البحث_داخل(strStartingPath + strTestPath)
If strFoundFile <> "" Then
البحث_داخل = strFoundFile
Exit Function
End If
End If
strAllFolders = Right(strAllFolders, Len(strAllFolders) - iI)
iI = 0
End If
If strAllFolders = "" Then Exit Function
Loop
End Functionهذا الموضوع مغلق.