0

I'm trying to close a form in which a video is playing. I want it to close said form when the video ends.

I'm using wmp embedded into my form, with ui mode hidden.

Thanks

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

1 Answers1

1

You can subscribe to the PlayStateChange event of the player.

wmp.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(wmp_PlayStateChange);

private void wmp_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
    if(e.newState == 8)
       this.Close();
}
keyboardP
  • 68,824
  • 13
  • 156
  • 205
  • You're welcome. If that's answered your question, you can click the check mark on the left to accept it as an answer :) – keyboardP Apr 21 '13 at 21:18