MPIon
Well-known member
I have several Media Player Controls on my form - created in code and need to identify which control has a state change.
The code is :
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Then for each control, I add an event handler :-
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Finally the event handler is  :-
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
This does work and the video playing is paused, but I need to identify which of the Media Player controls caused the event, i.e. what is the Index into mediaPlayerBoxes.
Can't figure out how to get this.
	
		
			
		
		
	
				
			The code is :
			
				C#:
			
		
		
		        static readonly AxWindowsMediaPlayer[] mediaPlayerBoxes = new AxWindowsMediaPlayer[16];
			
				C#:
			
		
		
		mediaPlayerBoxes[i].StatusChange += MediaPlayer_StateChange;
			
				C#:
			
		
		
		        private    void MediaPlayer_StateChange(object sender, EventArgs e)
        {
            // Get a local reference to the box that was clicked
            AxWindowsMediaPlayer player = sender as AxWindowsMediaPlayer;
            player.Ctlcontrols.pause();
        }Can't figure out how to get this.
 
	 
 
		 
					
				 
 
		 
 
		 
 
		