string strUrl = strpath + "\\" + strname + ".mp3"; 大虾帮忙看一下这句代码什么意思 小弟刚学看不懂

 我来答
席念真
2011-09-09 · TA获得超过183个赞
知道答主
回答量:431
采纳率:0%
帮助的人:280万
展开全部
已经完成,请留下E _ M _ A _I L或者用下面内容

1.建立一个窗体
2.放置一个文本框,用于输入索引路径,文本框命名为txtDirPath
3.放置一个按钮,用于开始索引,按钮命名为cmdSearch
4.放置一个Label,用于显示索引进度,命名为lblState
5.放置一个Command按钮,用于保存索引结果,命名为cmdSave

程序代码如下:
Dim searchingPath As String

Dim pl As Long
Dim finalOut As String
Dim c As Long

Private Sub cmdSave_Click()
Open "c:\out.txt" For Output As #1
Print #1, finalOut
Close #1
lblState.Caption = "保存完成! 已经写入到C:\Out.txt": DoEvents
End Sub

Private Sub cmdSearch_Click()
c = 0
If Right(txtDirPath.Text, 1) <> "\" Then txtDirPath.Text = txtDirPath.Text + "\"
pl = Len(txtDirPath.Text)
SearchFile txtDirPath.Text
End Sub

Private Sub Form_Load()
Me.Show
txtDirPath.SetFocus
txtDirPath.SelStart = Len(txtDirPath.Text)
End Sub

Private Sub txtDirPath_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then cmdSearch_Click
End Sub

Sub SearchFile(strPath As String)
On Error Resume Next
Dim strName As String
Dim dir_i() As String
Dim i As Long, idir As Long
Dim showStr As String

If Right(strPath, 1) <> "\" Then strPath = strPath + "\"
strName = Dir(strPath, vbDirectory Or vbHidden Or vbNormal Or vbReadOnly)

Do While Len(strName) > 0
If strName <> "." And strName <> ".." Then
If (GetAttr(strPath & strName) And vbDirectory) = vbDirectory Then
idir = idir + 1
ReDim Preserve dir_i(idir) As String
dir_i(idir - 1) = strName
Else
c = c + 1
showStr = Replace(Mid(strPath, pl + 1), "\", "><")
finalOut = finalOut + "<" + Left(showStr, Len(showStr) - 1) + strName + vbCrLf
End If
End If
strName = Dir

If searchingPath <> strPath Then
lblState.Caption = "索引数: " & CStr(c) & ",搜索目录: " & strPath
searchingPath = strPath
DoEvents
End If
Loop

For i = 0 To idir - 1
Call SearchFile(strPath + dir_i(i))
Next i

Erase dir_i

lblState.Caption = "搜索完成,总计文件数: " & CStr(c)
End Sub
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式