我试图检查声音文件是否已在 vb.net 中使用 windows MCI API 结束,但它不断出现无效的设备名称(263 - MCIERR_INVALID_DEVICE_NAME),是因为我的语法还是其他错误?
Public Sub CheckAndPlay(ButtonName As String)
Dim Target As Integer
Dim Position As String = Space(256)
Dim Length As String = Space(256)
Target = Microsoft.VisualBasic.Right(ButtonName, 2)
w = mciSendString("status " & Target & " position", Position, 256, 0)
w = mciSendString("status " & Target & " length", Length, 256, 0)
If Val(Position) = Val(Length) - 10 Or Val(Length) = Nothing Or Val(Position) = 0 Or Val(Position) = Nothing Then
w = mciSendString("play " & ButtonName, Nothing, 0, 0)
End If
End Sub