Home > Software design >  How to stop playing a sound that is played with the PlaySound() function?
How to stop playing a sound that is played with the PlaySound() function?

Time:05-13

I played a sound using the PlaySound() function. How can I stop playing that sound? Is there any function that can do that job?

CodePudding user response:

The documentation has the following to say about the pszSound parameter:

If this parameter is NULL, any currently playing waveform sound is stopped.

Following that contract you simply call

::PlaySound(nullptr, nullptr, 0);

to stop playing.

CodePudding user response:

You can use the following:

PlaySound(NULL, NULL, 0);
  • Related