Results 1 to 5 of 5

Thread: -= help with playing sound clips =-

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Location
    Charleston, SC - USA
    Posts
    2

    Question

    Hey.. I amm trying to figure out how to make a command button play a sound clip. If someone could help me out, that would be great. Thanks!

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Use the MCISENDSTRING API call - theres a help and example page on this at :

    http://www.vbapi.com/ref/m/mcisendstring.html

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Location
    Charleston, SC - USA
    Posts
    2

    Exclamation help!

    Alright.. well.. I went to that page and set up my program as directed. Now when I click on my command buttons that should be playing the wav files, i get this error message:

    MMSYSTEM263 This is not a registered MCI device.

    Can anyone help me? or provide me with an alternate method?

  4. #4
    Guest
    Or you can use the PlaySound API function.


    Code:
    Option Explicit
    
    Private Declare Function PlaySound Lib "winmm.dll" _
    Alias "PlaySoundA" (ByVal lpszName As String, ByVal _
    hModule As Long, ByVal  dwFlags As Long) As Long
    
    Private Const SND_SYNC = &H0 ' Play synchronously (default).
    Private Const SND_ASYNC = &H1 ' Play asynchronously (see note below).
    Private Const SND_NODEFAULT = &H2  ' Do not use default sound.
    Private Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file.
    Private Const SND_LOOP = &H8 ' Loop the sound until next sndPlaySound.
    Private Const SND_NOSTOP = &H10 ' Do not stop any currently playing sound.
    Private Const SND_PURGE = &H40 ' purge non-static events for task
    
    Private Sub Form_Load()
        'Play a WAV File
        PlaySound "C:\welcome.wav", 0&, SND_ASYNC Or SND_NODEFAULT
    
        'Play a WAV file with loop
        'PlaySound "C:\welcome.wav", 0&, SND_ANSYC Or SND_LOOP
    
        'Stop playing a WAV file
        'PlaySound "C:\welcome.wav", 0&, SND_PURGE
    End Sub

  5. #5
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    dont say "sequencer" in the line, say "wave" or "audio" I think that's yer problem...
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

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