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条经验 获得超2个赞
API函数sleep()
功能暂停执行,参数单位毫秒
如:sleep(1000) 暂停1秒
Public Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

神不在的星期二
TA贡献1963条经验 获得超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之内暂停
添加回答
举报
0/150
提交
取消