[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Using right click with AxShockwaveFlashObjects.AxShockwaveFlash

Posted on 2009-12-29
Medium Priority
Last Modified: 2012-05-08
In my winform app I use the AxShockwaveFlashObjects.AxShockwaveFlash in order to display flash movie.
When the flash movie is playing the right click show the flash movie context menu.
I would like to show my context menu at the right click event instead the  flash movie context menu.
How can I do this?
Question by:yaron89
LVL 33

Accepted Solution

Todd Gerbert earned 2000 total points
ID: 26149365
This is the best I could come up with.

I created a class that listens for a right mouse click on a control.  The control whose right mouse you want to catch is passed in the constructor,

rightMouseCatcher = new CatchRightMouseButton(axShockwaveFlash1);

Will cause the CatchRightMouseButton rightMouseCatcher to intercept right mouse button down messages intended for axShockwaveFlash1 and raise an event in your form instead of allowing axShockwaveFlash1 to process the message.

In this simple example I have it showing a message box, but instead you would popup a contextmenu.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
	public partial class Form1 : Form
		private CatchRightMouseButton rightMouseCatcher;

		public Form1()

			rightMouseCatcher = new CatchRightMouseButton(axShockwaveFlash1);
			rightMouseCatcher.RightMouseClick += new EventHandler(mw_RightMouseClick);

		void mw_RightMouseClick(object sender, EventArgs e)
			MessageBox.Show("Show My Own Menu");

	public class CatchRightMouseButton : NativeWindow
		public event EventHandler RightMouseClick;

		public enum WindowsMessages : int
			WM_LBUTTONDOWN = 0x0201,
			WM_RBUTTONDOWN = 0x0204

		public CatchRightMouseButton(Control parent)
			parent.HandleDestroyed += new EventHandler(parent_HandleDestroyed);

		void parent_HandleDestroyed(object sender, EventArgs e)

		protected virtual void OnRightMouseClick()
			if (RightMouseClick != null)
				RightMouseClick(this, new EventArgs());

		protected override void WndProc(ref Message m)

			switch ((WindowsMessages)m.Msg)
				case WindowsMessages.WM_RBUTTONDOWN:
					base.WndProc(ref m);


Open in new window


Author Closing Comment

ID: 31670870
Thank you !

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question