468,761 Members | 1,731 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,761 developers. It's quick & easy.

How to play sound from resource file?

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.
Nov 17 '05 #1
2 3427
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,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Alex K." <Al***@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
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.

Nov 17 '05 #2
See Windows Forms Tips and Tricks for example code in C# or VB

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Alex K." <Al***@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
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.

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Ron Provost | last post: by
1 post views Thread by Lam | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.