im trying to check whether a sound file has ended using the windows MCI API in vb.net but it keeps coming up with an invalid device name (263 - MCIERR_INVALID_DEVICE_NAME), is it because of my syntax or some other error?
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