Disabling Default Sound in NT


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Disabling Default Sound in NT

Hybrid View

  1. #1
    Drew Warren Guest

    Disabling Default Sound in NT

    In the following code on the click of button 1 it starts playing a wav file
    in a loop. On the click of the second button I want the wav to stop playing.
    On the second click I also want the default sound disabled when clicked.
    This works fine in Win95 but when I use the SND_NODEFAULT in NT it doesn't
    even stop the wav from playing. This is in VB6. Does anyone have any ideas
    how I can stop the wav from playing along with disabling the default sound
    in NT?
    -------

    'Sound Constants
    Const SND_SYNC = &H0
    Const SND_ASYNC = &H1
    Const SND_NODEFAULT = &H2
    Const SND_LOOP = &H8
    Const SND_NOSTOP = &H10

    Private Declare Function sndPlaySound Lib "WINMM" _
    Alias "sndPlaySoundA" (ByVal lpszSoundName _
    As String, ByVal uFlags As Long) As Long

    Private Sub Command2_Click()

    Dim lRtn As Long
    Dim wFlags%

    'Kill Sound
    wFlags% = SND_ASYNC Or SND_NODEFAULT
    lRtn = sndPlaySound(vbNull, wFlags%)

    End Sub

    Private Sub Command1_Click()

    Dim lRtn As Long
    Dim wFlags%

    'Play Sound Asynchronously
    wFlags% = SND_ASYNC Or SND_LOOP
    lRtn = sndPlaySound("G:\Dev\SndTest\Default.wav", wFlags%)

    End Sub



  2. #2
    Phil Weber Guest

    Re: Disabling Default Sound in NT

    > This works fine in Win95 but when I use the SND_
    > NODEFAULT in NT it doesn't even stop the WAV from
    > playing.


    Drew: Try making your wFlags variables Longs instead of Integers and see if
    it helps.
    ---
    Phil Weber



  3. #3
    Drew Warren Guest

    Re: Disabling Default Sound in NT

    Nope...that didn't seem to have any effect on it.

    "Phil Weber" <pweber@teleport.com> wrote:
    > This works fine in Win95 but when I use the SND_
    > NODEFAULT in NT it doesn't even stop the WAV from
    > playing.


    Drew: Try making your wFlags variables Longs instead of Integers and see if
    it helps.
    ---
    Phil Weber



  4. #4
    Phil Weber Guest

    Re: Disabling Default Sound in NT

    > This works fine in Win95 but when I use the SND_
    > NODEFAULT in NT it doesn't even stop the WAV from
    > playing.


    Drew: Try making your wFlags variables Longs instead of Integers and see if
    it helps.
    ---
    Phil Weber



  5. #5
    Drew Warren Guest

    Re: Disabling Default Sound in NT

    Nope...that didn't seem to have any effect on it.

    "Phil Weber" <pweber@teleport.com> wrote:
    > This works fine in Win95 but when I use the SND_
    > NODEFAULT in NT it doesn't even stop the WAV from
    > playing.


    Drew: Try making your wFlags variables Longs instead of Integers and see if
    it helps.
    ---
    Phil Weber



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center