Click here to Skip to main content
15,891,253 members
Home / Discussions / C#
   

C#

 
AnswerRe: can't get float value Pin
phil.o31-Aug-10 0:34
professionalphil.o31-Aug-10 0:34 
AnswerRe: can't get float value Pin
Luc Pattyn31-Aug-10 2:23
sitebuilderLuc Pattyn31-Aug-10 2:23 
QuestionAbstract Static and Inheritance Pin
Matthew Klein30-Aug-10 15:28
Matthew Klein30-Aug-10 15:28 
AnswerRe: Abstract Static and Inheritance Pin
PIEBALDconsult30-Aug-10 16:50
mvePIEBALDconsult30-Aug-10 16:50 
GeneralRe: Abstract Static and Inheritance Pin
Matthew Klein31-Aug-10 4:38
Matthew Klein31-Aug-10 4:38 
GeneralRe: Abstract Static and Inheritance Pin
Chris Trelawny-Ross31-Aug-10 5:35
Chris Trelawny-Ross31-Aug-10 5:35 
AnswerRe: Abstract Static and Inheritance Pin
Ennis Ray Lynch, Jr.31-Aug-10 6:16
Ennis Ray Lynch, Jr.31-Aug-10 6:16 
QuestionC# - Easy - Music Player & Next Song [modified] Pin
Martiinus30-Aug-10 13:52
Martiinus30-Aug-10 13:52 
Hello!

Today i try write my own Music Player in C# - winmm.dll, but I don't know, how to go to next song, when last is end.

My Aplication:
Button1. Load music.
Button2. Add address from textBox, to listbox.
Button3. Stop playing.

And all work, when i add my music to playlist, and click on selected address, music start. But:
- How i can go to next song, when last end?. Because now, when song is end, player no start play next song.
Eg:
Music1
Music2
Music3
Music4

Eg.
- When I click on Music2 it starts to play, but then wants go to the next song when Music2 end - in this case Music3.

- When I click on Music1 it starts to play, but then wants go to the next song when Music1 end - in this case Music2.
etc... Easy Play list...

&&

When Music4 end, player must go to first song! In this case - Music1!

This is my code:

<br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using System.Runtime.InteropServices;<br />
 <br />
namespace WindowsFormsApplication1<br />
{<br />
    public partial class Form1 : Form<br />
    {<br />
        [DllImport("winmm.dll")]<br />
        private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);<br />
        public Form1()<br />
        {<br />
            InitializeComponent();<br />
        }<br />
 <br />
        private void button1_Click(object sender, EventArgs e)<br />
        {<br />
            if (openFileDialog1.ShowDialog() == DialogResult.OK)<br />
            {<br />
                textBox1.Text = openFileDialog1.FileName;<br />
            }<br />
        }<br />
 <br />
        private void button2_Click(object sender, EventArgs e)<br />
        {<br />
            listBox1.Items.Add(textBox1.Text);<br />
        }<br />
 <br />
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)<br />
        {<br />
            mciSendString("close MediaFile", null, 0, IntPtr.Zero);<br />
            mciSendString("open \"" + listBox1.Items[listBox1.SelectedIndex].ToString() + "\" type mpegvideo alias MediaFile", null, 0, IntPtr.Zero);<br />
            mciSendString("play MediaFile", null, 0, IntPtr.Zero);<br />
 <br />
        }<br />
 <br />
        private void button3_Click(object sender, EventArgs e)<br />
        {<br />
            mciSendString("close MediaFile", null, 0, IntPtr.Zero);<br />
        }<br />
 <br />
    }<br />
}<br />


Please help! Frown | :(

modified on Monday, August 30, 2010 8:00 PM

AnswerRe: C# - Easy - Music Player & Next Song Pin
Luc Pattyn30-Aug-10 15:00
sitebuilderLuc Pattyn30-Aug-10 15:00 
AnswerRe: C# - Easy - Music Player & Next Song Pin
Martiinus30-Aug-10 15:27
Martiinus30-Aug-10 15:27 
AnswerRe: C# - Easy - Music Player & Next Song Pin
Luc Pattyn30-Aug-10 15:48
sitebuilderLuc Pattyn30-Aug-10 15:48 
QuestionPassing a C# variable to included javascript file Pin
Sonar8730-Aug-10 12:41
Sonar8730-Aug-10 12:41 
AnswerRe: Passing a C# variable to included javascript file Pin
Not Active30-Aug-10 15:22
mentorNot Active30-Aug-10 15:22 
GeneralRe: Passing a C# variable to included javascript file Pin
Sonar8730-Aug-10 15:55
Sonar8730-Aug-10 15:55 
GeneralRe: Passing a C# variable to included javascript file Pin
Not Active30-Aug-10 16:07
mentorNot Active30-Aug-10 16:07 
GeneralRe: Passing a C# variable to included javascript file Pin
Sonar8730-Aug-10 17:12
Sonar8730-Aug-10 17:12 
GeneralRe: Passing a C# variable to included javascript file Pin
Not Active31-Aug-10 0:26
mentorNot Active31-Aug-10 0:26 
GeneralRe: Passing a C# variable to included javascript file Pin
Sonar8731-Aug-10 9:39
Sonar8731-Aug-10 9:39 
QuestionParsing a string Pin
jenya730-Aug-10 4:16
jenya730-Aug-10 4:16 
AnswerRe: Parsing a string Pin
Ennis Ray Lynch, Jr.30-Aug-10 4:18
Ennis Ray Lynch, Jr.30-Aug-10 4:18 
GeneralRe: Parsing a string Pin
jenya730-Aug-10 4:23
jenya730-Aug-10 4:23 
GeneralRe: Parsing a string Pin
Ennis Ray Lynch, Jr.30-Aug-10 4:25
Ennis Ray Lynch, Jr.30-Aug-10 4:25 
GeneralRe: Parsing a string Pin
jenya730-Aug-10 4:26
jenya730-Aug-10 4:26 
GeneralRe: Parsing a string Pin
jenya730-Aug-10 4:30
jenya730-Aug-10 4:30 
GeneralRe: Parsing a string PinPopular
Ian Shlasko30-Aug-10 4:43
Ian Shlasko30-Aug-10 4:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.