各位大大来解答下VB语句

来源:百度知道 编辑:UC知道 时间:2024/06/27 11:56:58
在下刚刚学VB 大侠们能不能解析下面 谢谢 听说百度上高手很多
Private Sub Timer3_Timer() '时钟控件的Enabled属性有效时运行这里的代码
Dim indexSta As Integer
Dim sudu As Integer
Dim iTime As Long
Dim iFirst As Integer
Dim iSecond As Integer
iHf = InStr(sHf, "t")
sPlay = Trim(Left(sHf, iHf - 1))
iFirst = InStr(sPlay, " ")
indexSta = Val(Left(sPlay, iFirst - 1))
iSecond = InStrRev(sPlay, " ")
iTime = Right(sPlay, Len(sPlay) - iSecond)
sudu = Mid(sPlay, iFirst + 1, iSecond - iFirst - 1)
If lLastPlay <> 0 Then
Call note_off(0, lLastPlay)
End If
Call note_on(0, indexSta, sudu) '参数分别为通道编号,音调,速度
lLastPlay = indexSta
Timer3.Interval = iTime
sHf = Right(sHf, Len(sHf) - iHf)
If sHf = "" Then
Timer3.Interval = 100 '时钟控件的Interval属性为100即100毫秒启动一次
Timer3.Enabled = False '时钟控件停止
Exit Sub
End If
End Sub

Private Sub Timer3_Timer() '时钟控件的Enabled属性有效时运行这里的代码
Dim indexSta As Integer
Dim sudu As Integer
Dim iTime As Long
Dim iFirst As Integer
Dim iSecond As Integer
iHf = InStr(sHf, "t") '在shf变量中查找字符“t”的位置
sPlay = Trim(Left(sHf, iHf - 1)) '从shf变量最左边起取ihf-1个字符 然后用Trim去掉2前导和尾随空白
iFirst = InStr(sPlay, " ") '继续找这个变量查找空格
indexSta = Val(Left(sPlay, iFirst - 1)) '取出第一个空格前的数字 转换成数值赋值给indexsta变量
iSecond = InStrRev(sPlay, " ") '从splay变量右边开始算起,第一个空格位置
iTime = Right(sPlay, Len(sPlay) - iSecond) '取得右边右边起到第一个空格的这段字符
sudu = Mid(sPlay, iFirst + 1, iSecond - iFirst - 1) '取得中间这段字符(splay变量应该是2个空格隔开3段)
If lLastPlay <> 0 Then '如果变量不为0 则执行
Call note_off(0, lLastPlay) '调用自定义过程note_off
End If
Call note_on(0, indexSta, sudu) '参数分别为通道编号,音调,速度
lLastPlay = indexSta
Timer3.Interval = iTime 'timer3控件 事件间隔设置为itime
sHf