[Webinar] Learn how to a build a cloud-first strategyRegister Now


VB.NET mciSendString Volume Error 261

Posted on 2014-08-02
Medium Priority
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?

Question by:rcd0
1 Comment
LVL 21

Accepted Solution

Randy Poole earned 2000 total points
ID: 40237447
Try this:
MsgBox(mciSendString("setaudio mywav volume to " & Volume.Value.ToString,vbNullString, 0, 0))

Open in new window


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question