Public Sub SearchSuffix(ByVal Path As String, ByVal Suffix As String)On Error Resume NextDim PathChild() As StringDim SPath As StringDim Temp As LongDim Number As LongDim CurrentPath As StringIf Right(Path, 1) <> "\" ThenPath = Path & "\"End IfSPath = Dir(Path, vbNormal Or vbReadOnly Or vbHidden Or vbSystem Or vbDirectory Or vbVolume)Do While SPath <> "" CurrentPath = Path & SPathForm1.StaPath.Panels(1).Text = CurrentPathDoEventsIf SPath <> "." And SPath <> ".." Then' 使用位比較來確定 SPath 代表一目錄。If (GetAttr(Path & SPath) And vbDirectory) = vbDirectory ThenTemp = Temp + 1ReDim Preserve PathChild(Temp)PathChild(Temp) = SPathElseIf UCase(Right(SPath, Len(Suffix))) = UCase(Suffix) ThenForm1.List1.AddItem Path & SPathEnd IfEnd IfEnd IfSPath = DirLoopFor Number = LBound(PathChild) To UBound(PathChild)If PathChild(Number) <> "" ThenSearchSuffix Path & PathChild(Number), SuffixEnd IfNext NumberEnd Sub
3 回答

臨摹微笑
TA貢獻1982條經(jīng)驗 獲得超2個贊
API函數(shù)sleep()
功能暫停執(zhí)行,參數(shù)單位毫秒
如:sleep(1000) 暫停1秒
Public Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

神不在的星期二
TA貢獻1963條經(jīng)驗 獲得超6個贊
dim needtostop as boolean
Private Sub Form_Load()
needtopause=false
end sub
private sub buttonpauseclick()
needtopause=true
end sub
private sub buttonresumeclick()
needtopause=false
end sub
....
Do While SPath <> ""
CurrentPath = Path & SPath
Form1.StaPath.Panels(1).Text = CurrentPath
DoEvents
while needtopause
doevents
wend
If SPath <> "." And SPath <> ".." Then
' 使用位比較來確定 SPath 代表一目錄。
....
這樣應該在制定的loop之內(nèi)暫停
添加回答
舉報
0/150
提交
取消