Results 1 to 6 of 6

Thread: about sounds...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    83

    Question

    how are you able to play sounds? (code) how can you stop sounds while playing? Can you load them into a file(hopefully .res)?

    thanks in advance!
    Ian Callanan
    VB6.0
    [email protected]

  2. #2
    Guest

    Thumbs up Try Something Like this

    Option Explicit
    '
    Private Declare Function PlaySound Lib "winmm.dll" Alias _
    "PlaySoundA" (ByVal IpszName as String, ByVal hModule As _
    Long, ByVal dwFlags As Long) As Long
    '
    Private Const SND_FILENAME = &H20000 ' name is a filename
    Private Const SND_AYSNC = &H1 ' play asynchronously
    Private Const SND_SYNC = &H0
    '
    Private Sub PlayASound()
    PlaySound App.Path & "\JamesBrown.wav",0,SND_SYNC
    End Sub

    Hope it helps...of course you could always BEEP

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    83
    could you clarify what all of that does....?
    Ian Callanan
    VB6.0
    [email protected]

  4. #4
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Read all about it...

    Check out this sister site for info on API's (this link will take you to the function described above):

    http://www.vbapi.com/ref/p/playsound.html
    ~seaweed

  5. #5
    Guest
    Or use the sndPlaySound API.

    Code for module.
    Code:
    Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
    Code to play sound.
    Code:
    Call sndPlaySound("C:\MySound.wav", &H1)
    And, yes you can add them to a RES file.



  6. #6
    Guest

    Thumbs up Ok it plays wav files

    All it does it replays .wav files. We have a whole series of sound bits etc which play during different events, we use this call to play them. Doesn't do anything else, just plays wav files...though will try out Megs API call.

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