Results 1 to 4 of 4

Thread: Playing System Sounds

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    Is there a way of playing system sounds other than the standard Beep, for example the menuclick or exit windows sound, or atleast fing the files so I can use PlaySound.

    Thanks in advance.

  2. #2
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    550
    Paste this into a module:

    Declare Function sndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
    Public Const SND_SYNC = &H0 ' play synchronously (default)
    Public Const SND_ASYNC = &H1 ' play asynchronously
    Public Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound

    Paste this into a form with a single button:


    Private Sub Command1_Click()
    sndPlaySound ByVal "C:\Sound.wav", &H1
    End Sub




  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Lightbulb

    Sure. You can specify registry entry for the sound event.
    Code:
    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_ASYNC = &H1
    
    
    Private Sub Command1_Click()
        PlaySound "SystemExit", 0&, SND_ASYNC
    End Sub
    Here are default predifined system names:

    SystemAsterisk
    SystemExclamation
    SystemExit
    SystemHand
    SystemQuestion
    SystemStart


    Good luck

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    thanks.

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