'How to stop playing a sound that is played with the PlaySound() function?

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



Solution 1:[1]

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.

Solution 2:[2]

You can use the following:

PlaySound(NULL, NULL, 0);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 IInspectable
Solution 2 Blindy