title: mciSendString/winmm.dll - Playing an Audio file
body: <p>I am working on a program in Visual Basic 2008, I am required to have different types of sounds with varying volumes. Hence My.Computer.Audio.Play is not a valid option.</p>
  
  <p>I decided to use mciSendString instead and found the following code</p>
  
  <pre><code>Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
  (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _
  ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
  
      mciSendString("close myWAV", Nothing, 0, 0)
      Dim fileName1 As String = 
      mciSendString("open " &amp; fileName1 &amp; " type mpegvideo alias myWAV", Nothing, 0, 0)
      mciSendString("play myWAV", Nothing, 0, 0)
  
      'min Volume is 1, max Volume is 1000
      Dim Volume As Integer = (SFXVolume * 100)
      mciSendString("setaudio myWAV volume to " &amp; Volume, Nothing, 0, 0)
  </code></pre>
  
  <p>Now this code I have tested and is working perfectly when filename1 = "C://Correct.wav"</p>
  
  <p>However when I use </p>
  
  <p>filename1 = My.Application.Info.DirectoryPath &amp; "\Correct.wav"</p>
  
  <p>I get no sound play whatsoever.</p>
  
  <p>Could anyone please help me correct my code so that this works.
  Thank you in advance.</p>