In my PowerPoint Add-in using VSTO, I am implementing an Application-level Mouse Hook
to capture mouse events like double click, right click, mouse over etc, by using MouseKeyboardActivityMonitor.dll
downloaded from Codeplex. The reason I am doing this is because PowerPoint doesn't have mouse related events to listen to and the ones it gives are not fired in edit-mode of the PowerPoint.
In my Add-in when user clicks a chart a menu appears which allows the user to perform various functions on the chart. All is working fine. I have captured mouse events and a customized menu is shown but the problem arises when the menu is closed after performing some action the default menu of PowerPoint appears on the screen.
Example: When user double clicks on the chart, I show my form menu like this.
//Listening to the MouseDoubleClick event
MyMouseHookListener.MouseDoubleClick += MyMouseHookListener_MouseDoubleClick;
//MouseDoubleClickEvent
void MyMouseHookListener_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)
{
FormMenu.ShowDialog(); //Displaying menu
}
This works fine, but when the user closes the form the default double click menu of PowerPoint Charts appears. Same is the problem with other mouse events.
How can I disable PowerPoint's event menus?
Update:
There is a bool
property named Cancel
which is provided by PowerPoint's WindowBeforeDoubleClick
and WindowBeforeRightClick
events. Which if set to true
cancels the default action that PowerPoint performs when an event is fired. How can i access this property in my MouseHook
events?