Results 1 to 5 of 5

Thread: Sound Enabling

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 1999
    Posts
    22

    Post

    Hello

    I am looking for the required OCX/DLL to enable a sound player to my program (ie: Goto your Control Panel/Sounds). The play and stop function is what I am in search for. Any help would be appreciated, thank you


    mikel

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923

    Post

    Look through the BB archives, it's the kind of question that appears all the time. In reply, here is some code I got from Serge's post

    Private Declare Function sndPlaySound Lib "WinMM.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
    Private Const SND_ASYNC = &H1
    Private Const SND_NODEFAULT = &H2
    Private Const SND_FLAG = SND_ASYNC Or SND_NODEFAULT

    Public Sub PlayWav(pWavFile As String)
    If Dir(pWavFile) <> "" Then
    Call sndPlaySound(pWavFile, SND_FLAG)
    End If
    End Sub

    Place this code on your button to play wav

    PlayWav "C:\Mysound.wav"

    If your looking for a console-based player (with buttons and length etc), use the Windows Media Player control.

    Regards,

    ------------------
    - Chris
    [email protected]
    If it ain't broke - don't fix it


    [This message has been edited by chrisjk (edited 12-01-1999).]

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 1999
    Posts
    22

    Post

    But what about a stop command?

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Call the Function Again using the SND_PURGE Flag:

    Private Const SND_PURGE = &H40

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Aug 1999
    Posts
    22

    Post

    Thank you, both of you

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