Link to home
Start Free TrialLog in
Avatar of rcd0
rcd0

asked on

VB.NET mciSendString Volume Error 261

I am using the following code



  Public Sub PlayWavFile(ByVal WavFilePath As String)
        Dim cmd As String = "open " & Chr(34) & WavFilePath & Chr(34) & " type waveaudio alias mywav"
     
        If mciSendString(cmd, Nothing, 0, IntPtr.Zero) = 0 Then
            MsgBox(mciSendString("setaudio mywav volume to " + Volume.Value.ToString, Nothing, 0, 0))
            Button1.Text = "Stop"
            mciSendString("play mywav notify", Nothing, 0, Me.Handle)
        Else
            MessageBox.Show(WavFilePath, "Error Loading Wav", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

Open in new window


I get an error 261 and no volume change.  Not knowing a lot about this, I also tried

mciSendString("setaudio mywav volume to " + Volume.Value.ToString, Nothing, 0, me.Handle)

Open in new window


Volume is a value from a trackball with minimum set to 1 and maximum set to 1000.  If I look at the statement, it says "setaudio mywav volume to 300".

Everything else works and this is pretty common statement, but for some reason can not get it to work.  

Any suggestions?

tnx
ASKER CERTIFIED SOLUTION
Avatar of Randy Poole
Randy Poole
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial