الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

شرح كود

بدأه اشليان في 10 يوليو 2009 · 0 رد · 350 مشاهدة · في لغة Ms Visual Basic 6 وما قبلها من إصدارات
مشاركة: واتساب X فيسبوك تيليجرام
#1

السلام عليكــم ورحمـة الله وبركاتــه ،،

ممكن شرح لهذا الكود

 

Private Function DirDiver(NewPath As String, DirCount As Integer, BackUp As String, Optional Igoner As Boolean) As Integer
On Error Resume Next
Static FirstErr As Integer
Dim DirsToPeek As Integer, AbandonSearch As Integer, ind As Integer
Dim OldPath As String, ThePath As String, entry As String
Dim retval As Integer
	SearchFlag = True
	DirDiver = False
	retval = DoEvents()
	If SearchFlag = False Then
		DirDiver = True
		Exit Function
	End If
	On Local Error GoTo DirDriverHandler
	DirsToPeek = Dir1.ListCount
	Do While DirsToPeek > 0 And SearchFlag = True
		OldPath = Dir1.Path
		Dir1.Path = NewPath
		If Dir1.ListCount > 0 Then
			Dir1.Path = Dir1.List(DirsToPeek - 1)
			AbandonSearch = DirDiver((Dir1.Path), DirCount%, OldPath)
		End If

		DirsToPeek = DirsToPeek - 1
		If AbandonSearch = True Then Exit Function
	Loop

	If File1.ListCount Then
		If Len(Dir1.Path) <= 3 Then
			ThePath = Dir1.Path
		Else
			ThePath = Dir1.Path + "\"

		End If

		For ind = 0 To File1.ListCount - 1
			entry = File1.List(ind)


			  Set Listvw = lvw.ListItems.Add()
			  Listvw.Text = entry
			  Listvw.SubItems(1) = ThePath
			  Found.Caption = Str(Val(Found.Caption) + 1)

		Next ind

	End If
	If BackUp <> "" Then
		Dir1.Path = BackUp
	End If
	Exit Function
DirDriverHandler:
	If Err = 7 Then
		DirDiver = True
		MsgBox " La zone de liste est pleine. Recherche abandonnée..."
		Exit Function

	End If
End Function

مواضيع مشابهة