We help IT Professionals succeed at work.
Get Started

VB.NET mciSendString Volume Error 261

rcd0 asked
Last Modified: 2015-05-18
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)
            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?

Watch Question
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE