CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Location
    India
    Posts
    15

    Playing and stopping WAVE is giving problem

    Hi,

    My requirement is to play a wav file and stop it in between. I found some function like PlaySound(). from this I am able to play, but I don't have any way to stop it in between.

    If anybody knows , pls tell me.

    Best Regards,
    Kapil



  2. #2
    Join Date
    May 1999
    Posts
    3

    Re: Playing and stopping WAVE is giving problem

    You have 2 ways to do that :
    The first use:
    sndPlaySound(strFileName,SND_ASYNC | SND_LOOP |SND_NODEFAULT); // put it in place you wanr to begin play.
    and
    sndPlaySound(NULL,SND_ASYNC );// put it in place you want to stop.

    The second you can use Thread:

    UINT PlayThread( LPVOID pParam )
    {
    CString strFile;
    strFile = ((CString)pParam);
    sndPlaySound(strFile, SND_SYNC );

    delete pParam;
    return 0;
    }
    use :
    AfxBeginThread(PlayThread, strFileName); // place you want to play sound
    and
    sndPlaySound(NULL,SND_ASYNC );// place you want to stop play.

    If any comment, please give me your ideas.
    Lac Bui
    E_Mail: [email protected]



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

Featured