Results 1 to 4 of 4

Thread: sound events

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2001
    Location
    UK
    Posts
    205

    sound events

    i know how to play sounds using the api. BUT!! how do i call a sound event, as in the ones that are stored in the sound scheme in the sounds control panel?

    Cheers
    Craig

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    maybe u have to do it the other way arround... get the name of the file connected to an event, and then play it... just thinking out loud
    -= a peet post =-

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Well you can get the filepath from the registry, that is the way I did....but then I learned that you can do it straight from the API.
    The key is using the SND_ALIAS const.

    VB Code:
    1. Private Const SND_ALIAS = &H10000
    2. Private Const SND_ASYNC = &H1
    3. Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    4.    
    5.     'then use it like this
    6.     PlaySound "SystemStart", ByVal 0&, SND_ALIAS Or SND_ASYNC

    The thing is you have to use the name of the key in the registry which is not always the name that shows up in the control panel.

    Look here:
    http://web.missouri.edu/~finaidtk/ezplay.htm

    or in the registry here:
    HKEY_CURRENT_USR\AppEvents\Schemes\Apps
    Last edited by Edneeis; Mar 27th, 2002 at 01:24 PM.

  4. #4
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    Slightly different than you asked, but you can associate sounds to your application through the control panel and they will be handled automatically by Windows.

    (Like when your program crashes, or when question windows are popped up).

    I can tell you how if you are interested.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

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