There is:

public static WindowsMediaPlayer WMPs = new WMPLib.WindowsMediaPlayer(); 

There is a timer1 some procedure loses track
Is there some more:

  if (ЧТО-ТО) { int i; i = listBox1.SelectedIndex; i++; listBox1.SelectedIndex = i; PlayURL(array[listBox1.SelectedIndex], 2); PlayURL(array[listBox1.SelectedIndex], 1); } 

Instead of "SOMETHING" should stand
"If the track is over, the code below is executed"
How to implement it?

    1 answer 1

    Your approach is wrong.

    You should not try to catch the timer when the track is over. You must subscribe to the event, and respond properly.

    You did not indicate where your WMPLib.WindowsMediaPlayer , so I’ll assume that you mean this one . The documentation mentions the events that are sent when the player’s state changes: PlayStateChange . Subscribe to it and react as you need. If you have autoplay enabled, it will probably be easier to subscribe to changing the current track: CurrentItemChange .