hello,
Actually, i want to play sound file from resource. I am using WindowMediaPlayer Control for window application. But there is only option is "URL" (Property of control) to play sound file. I don't want to use URL property. Because my sound file is present in the Resource.

Any body help me... How is it possible?
If my question is not clear then tell me i explain ti again. but plz help me.


I also want to use flash file(.swf) for WebBrowser control but not using URL Property and also without using sartup path. Means i want to use Resource path

IN C#

using System.Media;

SoundPlayer m_MySound = new SoundPlayer(Properties.Resources.YourSoundFile);


//invoke as this

m_MySound.Play();

as far as the swf control use the same method Properties.Resources.whatever

Sorry! friend.
But i am not using SoundPlayer.
I am using WindowMediaPlayer Control which have only URL property to play sound file.
Also i am not using swf control, i am using WebBrowser Control to play .swf (flash file). It has also URL property or we can use startup path.

plzzzzz help me ....Read my question.

Sorry! friend.
But i am not using SoundPlayer.
I am using WindowMediaPlayer Control which have only URL property to play sound file.
Also i am not using swf control, i am using WebBrowser Control to play .swf (flash file). It has also URL property or we can use startup path.

plzzzzz help me ....Read my question.

You missed the point of my response its not what you are using rather that getting to any resource that is in your project is located as Properties.Resources.XXXXXX

You missed the point of my response its not what you are using rather that getting to any resource that is in your project is located as Properties.Resources.XXXXXX

my brother,
we can not write like this xxxxxx.URL=Properties.Resources.XXXXX Please bro try to understand my problem.
but you are trying to solve my problem, so thank's for your help and help again plzzzzz

my brother,
we can not write like this xxxxxx.URL=Properties.Resources.XXXXX Please bro try to understand my problem.
but you are trying to solve my problem, so thank's for your help and help again plzzzzz

OK get rid of the WMPlib. Its not needed, instead once you have the file added as a resource( "add existing Item" in your solution explorer) then add this code to a button event or your form load event.

Dim process As System.Diagnostics.Process
process = New Process(Me.GetType().Assembly.GetManifestResourceStream _
("ApplicationNamespace.SoundFile.mp3")

WMPlib is used to create a Windows media player that will play files in the same directory as the app or as a movie player for media on the web (hence the .URL) It requires that the media be fed via URL link and only in a link. The code that I gave you earlier is also a good replacement for it as it does Not need the URL and will also implement the application resource information. Here is the Microshaft link for WMPlib (wmp.dll) This will explain it better and the limits within the library. Here is an example of its use.

Hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.