playing mp3 file using c#
-
heloo can anyone please help me out in writing a code in c# for playing .mp3 files i tried a lot and found this as iam a beginner to c# i didn't understand what is this and how and where to place it ? [DllImport("winmm.dll")] private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback); thx.
-
heloo can anyone please help me out in writing a code in c# for playing .mp3 files i tried a lot and found this as iam a beginner to c# i didn't understand what is this and how and where to place it ? [DllImport("winmm.dll")] private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback); thx.
Don't Repost. I have answered Below.
SSK. Anyone who says sunshine brings happiness has never danced in the rain.
-
heloo can anyone please help me out in writing a code in c# for playing .mp3 files i tried a lot and found this as iam a beginner to c# i didn't understand what is this and how and where to place it ? [DllImport("winmm.dll")] private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback); thx.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace audio1 { public partial class Form1 : Form { private string Pcommand; private bool isOpen; [DllImport("winmm.dll")] private static extern long mciSendString(string strCommand,StringBuilder strReturn,int iReturnLength, IntPtr hwndCallback); public void Close() { Pcommand = "close MediaFile"; mciSendString(Pcommand, null, 0, IntPtr.Zero); isOpen=false; } public void Open(string sFileName) { Pcommand = "open \"" + sFileName + "\" type mpegvideo alias MediaFile"; mciSendString(Pcommand, null, 0, IntPtr.Zero); isOpen = true; } public void Play(bool loop) { if(isOpen) { Pcommand = "play MediaFile"; if (loop) Pcommand += " REPEAT"; mciSendString(Pcommand, null, 0, IntPtr.Zero); } } public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { openFileDialog1.Filter = "|*.mp3"; openFileDialog1.ShowDialog(); textBox1.Text = openFileDialog1.FileName; Open(textBox1.Text); } private void button2_Click(object sender, EventArgs e) { Play(false); } private void button3_Click(object sender, EventArgs e) { Close(); } } }
-
heloo can anyone please help me out in writing a code in c# for playing .mp3 files i tried a lot and found this as iam a beginner to c# i didn't understand what is this and how and where to place it ? [DllImport("winmm.dll")] private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback); thx.
managed directX is much easier than this.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Don't Repost. I have answered Below.
SSK. Anyone who says sunshine brings happiness has never danced in the rain.
You can actually just paste the permalink which should act like a 302 Redirect. :)
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson