CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2001
    Location
    Quebec, Canada
    Posts
    4

    Playing Audio Files

    Hello,

    What do you have to do so that an audio file (ie wave) is played when a command is clicked?

    Thanks in advance for the help.

    --yellowTIGER--

  2. #2
    Join Date
    Oct 2000
    Location
    Upstate NY
    Posts
    249

    Re: Playing Audio Files

    Try This

    Put this at the top of your code

    Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal _ '(end of first line)

    'Below goes on one line
    lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

    'Put below in your code

    Private Sub Command1_Click()

    'Below goes on one line

    retVal = PlaySound("C:\WINDOWS\MEDIA\The Microsoft Sound.Wav", 0&, &H20000)

    End Sub

    73 RSH

    You can substitute the name of any wave file in above. this one I believe is the windows welcome sound.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured