Using right click with AxShockwaveFlashObjects.AxShockwaveFlash

Posted on 2009-12-29
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

    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

    Thank you !

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Article by: Najam
    Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
    This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now