DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  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
    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



  4. #4
    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



  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



Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links