You can play a system sound as follows:
SystemSounds.Asterisk.Play();
But it plays asynchronously. This is usually ok, but I want to wait for it to complete, and then run some other code afterwards. How to do this?
You can play a system sound as follows:
SystemSounds.Asterisk.Play();
But it plays asynchronously. This is usually ok, but I want to wait for it to complete, and then run some other code afterwards. How to do this?
This is not the only solution, but it's what I came up with.
You can do this using the
PlaySoundAPI (https://learn.microsoft.com/en-us/previous-versions/dd743680(v%3Dvs.85)).Use DllImport to bring in the reference:
Then your code to call it: