详细代码如下: Option Explicit Private Sub cmd搜索_Click() '向服务器请求下载歌词 Inet1.Execute "http://geci.chinamp3.com/relatedgeci.php?song_name=" & Trim(txt歌 名) & "&" & "singer_name=" & Trim(txt歌手), "get" End Sub Private Sub inet1_StateChanged(ByVal State As Integer) Dim 网页代码$ Dim 临时变量$ Dim 位置& If State = 11 Then MsgBox "出现错误!" ElseIf State = 12 Then Do '开始接受数据 DoEvents 临时变量$ = Inet1.GetChunk(1024, icString) If Len(临时变量$) = 0 Then Exit Do 网页代码$ = 网页代码$ & 临时变量$ '接受到的所有数据存放在变量 “网页代码$”中 Loop 位置& = InStr(1, 网页代码$, "歌词:") '首先寻找特征词“歌词:” If 位置& = 0 Then '如果没找到特征词“歌词:”就证明服务器上没提供要搜索的歌词 MsgBox "未收录这首歌的歌词!" Exit Sub Else '把歌词解析出来 '首先把“网页代码$”中“歌词:”前面的代码全部去掉 网页代码$ = Right(网页代码$, Len(网页代码$) - (位置& - 1)) '寻找第二个特征词“ ” 位置& = InStr(1, 网页代码$, " ") |
正在阅读:用VB写歌词搜索程序用VB写歌词搜索程序
2004-02-14 09:34
出处:电脑爱好者
责任编辑:linjixiong
键盘也能翻页,试试“← →”键