Results 1 to 26 of 26

Thread: how to stop the playsound when it is in loop

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    489

    how to stop the playsound when it is in loop

    and if there is a way to call it from different forms
    and play for each form different sound, please show me an example code

    thank you very much.

  2. #2
    gibra
    Guest

    Re: how to stop the playsound when it is in loop

    How to START play?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    489

    Re: how to stop the playsound when it is in loop

    Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

    PlaySound TempFileName, ByVal 0&, SND_FILENAME Or SND_ASYNC Or SND_LOOP Or SND_APPLICATION

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: how to stop the playsound when it is in loop

    play for each form different sound
    Place this in a module

    vb Code:
    1. Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _
    2. (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    Place this in the form load event of your each form....

    vb Code:
    1. Private Sub Form1_load()
    2.     Dim lngRet As Long, strSNDFile As String
    3.     '~~> Change this part for every Form to the respective file...
    4.     strSNDFile = "c:\windows\media\explode.wav"
    5.     lngRet = PlaySound("SystemStart", 0, &H0)
    6. End Sub
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    489

    Re: how to stop the playsound when it is in loop

    Quote Originally Posted by koolsid View Post
    Place this in a module

    vb Code:
    1. Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _
    2. (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    Place this in the form load event of your each form....

    vb Code:
    1. Private Sub Form1_load()
    2.     Dim lngRet As Long, strSNDFile As String
    3.     '~~> Change this part for every Form to the respective file...
    4.     strSNDFile = "c:\windows\media\explode.wav"
    5.     lngRet = PlaySound("SystemStart", 0, &H0)
    6. End Sub
    thank you
    what i try to guess that first i have to play this line in form_load

    Code:
        lngRet = PlaySound("SystemStart", 0, &H0)
    then every file i want

    i tried it
    -first it make the windows start sound
    -second it doesn't make a sound for each form
    btw i'm talking about MDI childs

    -third what about my first question
    how to make it shut up

    i tried this
    Code:
    PlaySound "", 0, 0
    but it doesn't work

    i have to close VB for the sound to turn off
    very confused

    i want to use this instead of direct X because direct X 8 needs installation
    on Vista and above

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    489

    Re: how to stop the playsound when it is in loop

    anyone ?

  7. #7
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: how to stop the playsound when it is in loop

    Sorry.. had missed this post...

    Once it starts playing it will not stop till it finishes playing the file...

    The best way to handle it is to use files which play only for 2-3 seconds...

    Have made few changes

    Place this in a module

    Code:
    Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _
    (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    
    Public Const SND_ASYNC As Integer = &H1
    Place this in every form/MDI Child load event

    Code:
    Private Sub Form_Load()
        Dim lngRet As Long, strSNDFile As String
        '~~> Change this part for every Form to the respective file...
        strSNDFile = "c:\windows\media\explode.wav"
        lngRet = PlaySound("SystemStart", 0, SND_ASYNC)
    End Sub
    Now if you see that whenever you open a form, the sound which you have specified will play...

    By the way, if you have noticed that in the above code I have added one line...

    Public Const SND_ASYNC As Integer = &H1
    This "SND_ASYNC" plays the sound asynchronously i.e it moves to the next line of code immediately after starting to play the sound and have it play in the background....
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  8. #8
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: how to stop the playsound when it is in loop

    Quote Originally Posted by whatsup View Post
    i tried this
    Code:
    PlaySound "", 0, 0
    but it doesn't work
    One of these should stop the current sound

    PlaySound vbNullString, 0&, SND_NODEFAULT
    or,
    PlaySound vbNullString, vbNull, SND_NODEFAULT
    or
    PlaySound vbNullString, 0&, 0&


    '''''''
    Code:
    Option Explicit
    ' To hear a sound for an event, the event must have a sound file
    ' associated with it in the users windows sound panel otherwise it will not play.
    ' If a sound is not avalable SND_NODEFAULT will return nothing, otherwise a beep will be heard.
    
    Const SND_ALIAS_SYSTEMASTERISK      As String = "SystemAsterisk"
    Const SND_ALIAS_SYSTEMDEFAULT       As String = "SystemDefault"
    Const SND_ALIAS_SYSTEMEXCLAMATION   As String = "SystemExclamation"
    Const SND_ALIAS_SYSTEMEXIT          As String = "SystemExit"
    Const SND_ALIAS_SYSTEMHAND          As String = "SystemHand"
    Const SND_ALIAS_SYSTEMQUESTION      As String = "SystemQuestion"
    Const SND_ALIAS_SYSTEMSTART         As String = "SystemStart"
    Const SND_ALIAS_SYSTEMWELCOME       As String = "SystemWelcome"
    Const SND_ALIAS_YouGotMail          As String = "MailBeep"
    
    ' playsound Params
    Const SND_LOOP = &H8
    Const SND_ALIAS = &H10000
    Const SND_NODEFAULT = &H2 ' silence if no sound associated with event
    Const SND_ASYNC = &H1 ' play async (don't freeze program while sound is playing)
    
    Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    
    Private Sub Command1_Click()
        ' loop "you got mail" sound until stopped!
        PlaySound SND_ALIAS_YouGotMail, vbNull, SND_ALIAS Or SND_NODEFAULT Or SND_ASYNC Or SND_LOOP
    End Sub
    
    Private Sub Command2_Click()
        PlaySound "SystemExclamation", vbNull, SND_ALIAS Or SND_NODEFAULT Or SND_ASYNC
    End Sub
    
    Private Sub Command3_Click()
        PlaySound "SystemAsterisk", vbNull, SND_ALIAS Or SND_NODEFAULT Or SND_ASYNC
    End Sub
    
    Private Sub Command4_Click()
        ' by default windows XP doesn't have a sound associated with the question event,
        ' the user neeeds to set it to a file in the sound control panel.
        PlaySound "SystemQuestion", vbNull, SND_ALIAS Or SND_NODEFAULT Or SND_ASYNC
    End Sub
    
    Private Sub Command5_Click()
        PlaySound SND_ALIAS_SYSTEMDEFAULT, vbNull, SND_ALIAS Or SND_NODEFAULT Or SND_ASYNC
    End Sub
    
    Private Sub Command6_Click()
        'Stop sound
        PlaySound vbNullString, ByVal 0&, SND_NODEFAULT
    ' or PlaySound vbNullString, vbNull, SND_NODEFAULT
    End Sub
    Last edited by Edgemeal; Oct 29th, 2009 at 05:50 PM.

  9. #9
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: how to stop the playsound when it is in loop

    @ Edge

    "SND_NODEFAULT" (Value : &H2)
    It is used if the specified sound cannot be found, terminate the function with failure instead of playing the System Default sound. If this flag is not specified, the System Default sound will play if the specified sound cannot be located and the function will return with success.

    This is the complete Flags table

    Flags Table
    ===========
    SND_ALIAS = &H10000: lpszName is a string identifying the name of the system event sound to play.
    SND_ALIAS_ID = &H110000: lpszName is a string identifying the name of the predefined sound identifier to play.
    SND_APPLICATION = &H80: lpszName is a string identifying the application-specific event association sound to play.
    SND_ASYNC = &H1: Play the sound asynchronously -- return immediately after beginning to play the sound and have it play in the background.
    SND_FILENAME = &H20000: lpszName is a string identifying the filename of the .wav file to play.
    SND_LOOP = &H8: Continue looping the sound until this function is called again ordering the looped playback to stop. SND_ASYNC must also be specified.
    SND_MEMORY = &H4: lpszName is a numeric pointer refering to the memory address of the image of the waveform sound loaded into RAM.
    SND_NODEFAULT = &H2: If the specified sound cannot be found, terminate the function with failure instead of playing the SystemDefault sound. If this flag is not specified, the SystemDefault sound will play if the specified sound cannot be located and the function will return with success.
    SND_NOSTOP = &H10: If a sound is already playing, do not prematurely stop that sound from playing and instead return with failure. If this flag is not specified, the playing sound will be terminated and the sound specified by the function will play instead.
    SND_NOWAIT = &H2000: If a sound is already playing, do not wait for the currently playing sound to stop and instead return with failure.
    SND_PURGE = &H40: Stop playback of any waveform sound. lpszName must be an empty string.
    SND_RESOURCE = &H4004: lpszName is the numeric resource identifier of the sound stored in an application. hModule must be specified as that application's module handle.
    SND_SYNC = &H0: Play the sound synchronously -- do not return until the sound has finished playing.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    489

    Re: how to stop the playsound when it is in loop

    sorry guys, it was my fault, i'm shame

    instead of vbnullstring i wrote "", and it didn't work of course
    until i decided to go by edge advice, and wrote vbnullstring
    and suddenly everything start to work as expected
    so i checked in the help
    and i found this
    vbNullString String having value 0 Not the same as a zero-length string (""); used for calling external procedures
    i think this can also solve me another problem with calling API

    now one thing still left,
    the playsound for each child doesn't work.
    though if it will not, it also good, but i prefer to know if this is possible, and how

    thanks for great help

  11. #11
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: how to stop the playsound when it is in loop

    Have you put it in each child form's load event mentioning the relevant file name?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    489

    Re: how to stop the playsound when it is in loop

    i put in the form_load event
    this line
    Code:
    playsound "SystemStart", 0, SND_ASYNC
    and in other sub, where i need to play, i put this line
    Code:
     PlaySound TempFileName, 0, SND_FILENAME Or SND_ASYNC Or SND_LOOP

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    489

    Re: how to stop the playsound when it is in loop

    so ?

  14. #14

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    489

    Re: how to stop the playsound when it is in loop

    no one know the answer for that ?

  15. #15

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    489

    Re: how to stop the playsound when it is in loop

    maybe an example code with MDI and 2 childs to demo how to use playsound to play different wave for each child at the same time ?

  16. #16
    Hyperactive Member
    Join Date
    Sep 2009
    Location
    Lost in thought
    Posts
    349

    Re: how to stop the playsound when it is in loop

    .

    The answer to your question is Here
    And here
    C:\Program Files\Microsoft Visual Studio\MSDN98\98VSa\1033\SAMPLES\VB98

    Please go to the "Thread Tools" menu at the top of this Thread, and click "Mark Thread Resolved" when you have your answer.
    So I can fine the answer when I need it.

    how to stop the playsound when it is in loop..Play more than 1 sound at a time..
    ini file Check if IP changed Strings 'Split', 'Left' and 'Right'
    Save And Load an Array of list-boxes, to and from a file......list-box and CommonDialog
    Quote Originally Posted by RobDog888

    So please install VB6 service pack 6 as its the latest and last supported service pack MS will ever make.
    http://support.microsoft.com/kb/q198880/ I'm sure this will fix your issue
    The only reason some people get lost in thought is because it’s unfamiliar territory. —Paul Fix

  17. #17
    gibra
    Guest

    Re: how to stop the playsound when it is in loop

    Quote Originally Posted by whatsup View Post
    maybe an example code with MDI and 2 childs to demo how to use playsound to play different wave for each child at the same time ?

    see attached sample.
    Project of 5ms? modified (2)
    Attached Files Attached Files

  18. #18

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    489

    Re: how to stop the playsound when it is in loop

    hay man, i'm really glad you tried to help,
    and i really appreciate this.

    sorry that i didn't explained myself,
    i am looking after a way, to play from 2 different childs, at the same time,
    so i can hear for example 2 waves playing at the same time.

    the way you show, is what i know already,
    is when you play a sound, any previuos sound, is turned off.

  19. #19
    Hyperactive Member
    Join Date
    Sep 2009
    Location
    Lost in thought
    Posts
    349

    Re: how to stop the playsound when it is in loop

    Quote Originally Posted by gibra View Post
    see attached sample.
    Project of 5ms? modified (2)
    Nice mod

    Quote Originally Posted by whatsup View Post
    hay man, i'm really glad you tried to help,
    and i really appreciate this.

    sorry that i didn't explained myself,
    i am looking after a way, to play from 2 different childs, at the same time,
    so i can hear for example 2 waves playing at the same time.

    the way you show, is what i know already,
    is when you play a sound, any previuos sound, is turned off.
    Not with PlaySound

    But look here
    Quote Originally Posted by Jacob Roman View Post
    The PlaySound API only plays one sound at a time and is very limited of its capabilities. You get a lack of control. So if you are making a game or a music app, it is better to use DirectSound or WAVEMIX32, for more control over your sound, and allow more than one sound to play at the same time. Here are some tutorials on DirectSound:
    DirectX
    Last edited by 5ms?; Nov 8th, 2009 at 09:23 AM.
    .

    The answer to your question is Here
    And here
    C:\Program Files\Microsoft Visual Studio\MSDN98\98VSa\1033\SAMPLES\VB98

    Please go to the "Thread Tools" menu at the top of this Thread, and click "Mark Thread Resolved" when you have your answer.
    So I can fine the answer when I need it.

    how to stop the playsound when it is in loop..Play more than 1 sound at a time..
    ini file Check if IP changed Strings 'Split', 'Left' and 'Right'
    Save And Load an Array of list-boxes, to and from a file......list-box and CommonDialog
    Quote Originally Posted by RobDog888

    So please install VB6 service pack 6 as its the latest and last supported service pack MS will ever make.
    http://support.microsoft.com/kb/q198880/ I'm sure this will fix your issue
    The only reason some people get lost in thought is because it’s unfamiliar territory. —Paul Fix

  20. #20
    gibra
    Guest

    Re: how to stop the playsound when it is in loop

    Quote Originally Posted by whatsup View Post
    hay man, i'm really glad you tried to help,
    and i really appreciate this.

    sorry that i didn't explained myself,
    i am looking after a way, to play from 2 different childs, at the same time,
    so i can hear for example 2 waves playing at the same time.

    the way you show, is what i know already,
    is when you play a sound, any previuos sound, is turned off.
    Sorry, I misunderstand, but... however your initial request was:
    how to stop the playsound when it is in loop
    that's quite different from what you ask now!


    Then you must to use MCI.
    As example, you can start by this project:
    C:\Program files\Microsoft Visual Studio\MSDN98\98VS\1033\SAMPLES\VB98\MCI

    Open the prject MCITest and make some changes:

    1.
    Open frmMCITest form, in the routine below
    Private Sub AI_WAVEAUDIO_Click()

    insert this statements

    Code:
        New_Wave
        Exit Sub
    2.
    In same form, add this new routine:
    Code:
    Public Sub New_Wave()
        DialogCaption = "Audio Wave - "
        Dim fWave As frmWave
        Set fWave = New frmWave
        fWave.Caption = "Audio Wave"
        frmOpenDlg.dlgOpenFile.Filter = "File Wave (*.wav)|*.wav"
        fWave.mciWave.DeviceType = "WaveAudio"
        fWave.Show
    End Sub
    That allow you to open two or more instances of frmWave.

    3.
    Open frmWave form, and in the routine:
    Private Sub AI_OPEN_Click()

    Comment the lines that close the wave device:
    ' If Not mciWave.Mode = vbMCIModeNotOpen Then
    ' mciWave.Command = "Close"
    ' End If

    4. Run the project
    5. from main menu click 2 times to Audio_Wave menu item: this open 2 instances of frmWave (move one form to see both)
    6. in both instance of frmWave open a different WAVE file
    7. finally, start play both the frmWave


    Take note that the above project use MCI32.OCX, however you can achieve same result via API, learning MCI functions:
    http://msdn.microsoft.com/en-us/libr...74(VS.85).aspx

    Example here
    http://allapi.mentalis.org/apilist/mciSendCommand.shtml

    Last edited by gibra; Nov 8th, 2009 at 04:13 AM.

  21. #21

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    489

    Re: how to stop the playsound when it is in loop

    thanks for that, so for that i was looking for,
    for an answer that this is can't be done with playsound.

    i can't use MCI because i need to play my waves in loop,
    (they're very short, only one cycle waveform, to use later in a synth),
    and MCI doesn't support that (i think) that's why i needed PlaySound.

    EDIT: but maybe with MCI API it's possible to play in loop ?
    Last edited by whatsup; Nov 8th, 2009 at 07:22 AM.

  22. #22
    Hyperactive Member
    Join Date
    Sep 2009
    Location
    Lost in thought
    Posts
    349

    Re: how to stop the playsound when it is in loop

    Quote Originally Posted by whatsup View Post
    thanks for that, so for that i was looking for,
    for an answer that this is can't be done with playsound.

    i can't use MCI because i need to play my waves in loop,
    (they're very short, only one cycle waveform, to use later in a synth),
    and MCI doesn't support that (i think) that's why i needed PlaySound.

    EDIT: but maybe with MCI API it's possible to play in loop ?
    Search is your frend
    Search: Keyword(s): DirectSound ; Forum: Visual Basic 6 and Earlier and child forums
    .

    The answer to your question is Here
    And here
    C:\Program Files\Microsoft Visual Studio\MSDN98\98VSa\1033\SAMPLES\VB98

    Please go to the "Thread Tools" menu at the top of this Thread, and click "Mark Thread Resolved" when you have your answer.
    So I can fine the answer when I need it.

    how to stop the playsound when it is in loop..Play more than 1 sound at a time..
    ini file Check if IP changed Strings 'Split', 'Left' and 'Right'
    Save And Load an Array of list-boxes, to and from a file......list-box and CommonDialog
    Quote Originally Posted by RobDog888

    So please install VB6 service pack 6 as its the latest and last supported service pack MS will ever make.
    http://support.microsoft.com/kb/q198880/ I'm sure this will fix your issue
    The only reason some people get lost in thought is because it’s unfamiliar territory. —Paul Fix

  23. #23
    gibra
    Guest

    Re: how to stop the playsound when it is in loop

    Quote Originally Posted by whatsup View Post
    EDIT: but maybe with MCI API it's possible to play in loop ?
    Yes, of course.
    Search on MSDN help file for MCI control event Done, and properties Notify, NotifyMessage and NotifyValue.
    Last edited by gibra; Nov 8th, 2009 at 10:55 AM.

  24. #24
    New Member
    Join Date
    May 2015
    Posts
    9

    Re: how to stop the playsound when it is in loop

    When I start playing a sound using -

    RetVal = PlaySound("C:\HelloWorld.wav", 0&, &H20000)

    is there any way to get a handle on that operation whereby I could kill the operation ?

    If one is playing multiple sounds, one could put each handle (if available) into an array where it can be retrieved to kill the particular sound. My problem is that when I close the form that is playing the sound, using Unload Me, the sound keeps playing.

    Will appreciate any info on availability of a handle to identify the particular sound that would allow killing the sound.

  25. #25
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,624

    Re: how to stop the playsound when it is in loop

    boblite....start your own thread...this one is real, real old.

  26. #26
    New Member
    Join Date
    May 2015
    Posts
    9

    Re: how to stop the playsound when it is in loop

    thanks for the heads up, Sam

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