Results 1 to 3 of 3

Thread: how to stop a Playing/running wavefile

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Posts
    70

    Question how to stop a Playing/running wavefile

    hello

    How to stop a wavefile thats running. i want to have it through menu operation. like file -- stopplay. and as soon as i click on stopplay it will stop playing the running wavefile...

    any ideas??

    radhika

  2. #2
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    VB Code:
    1. Option ExplicitOption Explicit
    2. Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    3.  
    4. Const SND_APPLICATION = &H80    ' look for application specific association
    5. Const SND_ALIAS = &H10000       ' name is a WIN.INI [sounds] entry
    6. Const SND_ALIAS_ID = &H110000   ' name is a WIN.INI [sounds] entry identifier
    7. Const SND_ASYNC = &H1           ' play asynchronously
    8. Const SND_FILENAME = &H20000    ' name is a file name
    9. Const SND_LOOP = &H8            ' loop the sound until next sndPlaySound
    10. Const SND_MEMORY = &H4          ' lpszSoundName points to a memory file
    11. Const SND_NODEFAULT = &H2       ' silence not default, if sound not found
    12. Const SND_NOSTOP = &H10         ' don't stop any currently playing sound
    13. Const SND_NOWAIT = &H2000       ' don't wait if the driver is busy
    14. Const SND_PURGE = &H40          ' purge non-static events for task
    15. Const SND_RESOURCE = &H40004    ' name is a resource name or atom
    16. Const SND_SYNC = &H0            ' play synchronously (default)
    17.  
    18. Dim strFileName As String
    19.  
    20. Private Sub cmdPlay_Click()
    21.     strFileName = "C:\WINNT\Media\Windows Logon Sound.wav"
    22.     PlaySound strFileName, ByVal 0&, SND_FILENAME Or SND_ASYNC
    23. End Sub
    24.  
    25. Private Sub cmdStop_Click()
    26.     strFileName = vbNullString
    27.     PlaySound strFileName, ByVal 0&, SND_PURGE
    28. End Sub
    Last edited by MarkT; May 8th, 2002 at 08:46 PM.

  3. #3
    Stiletto
    Guest
    Or you can use the Windows Media Control

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