How to play sound from resource file?

G

Guest

I need to play particular sound when user presses a button.
I found PlaySound function in the Platform SDK, it works fine, but it can
only play external wav file. I'd like to load my sound file into app
resources and play it from there, similar to how I process image files.
Any ideas?

Thank you.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

I dont know of nothing in the framework for playing sounds, I use PlaySuond
from the Win32 API , I believe you will have to P/Invoke this. You could
create a file in memory , but not sure if it will work.

Now I did remember that I hear about a managed DirectX implementation, there
you should find something to play sounds , it would be wise to take a look
into this.


cheers,
 
B

Bob Powell [MVP]

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top