Hi,
I am trying to intercept the WM_MOUSEWHEEL and WM_MBUTTONDOWN messages in the ACAD window.
I have found and modified slightly the following code which allows me to intercept it on a form opened from an Acad Command, but how can I do it in the actual Acad Window ?
Any help appreciated,
Thanks
j
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace wm_wheel1
{
public partial class Form1 : Form
{
// Create a delegate for the custom shutdown event.
public delegate void DoSDCheck(object sender, System.EventArgs e);
// Create an event based on the delegate.
public static event DoSDCheck ThisSDCheck;
// Define an event handler for the custom event.
public static void HandleShutdown(object sender, System.EventArgs e)
{
// Display a simple message box.
MessageBox.Show("Tocando la rueda");
}
//public const Int32 WM_QUERYENDSESSION = 0x0011;
//public const Int32 WM_ENDSESSION = 0x0016;
public const Int32 WM_MOUSEWHEEL = 0x20A;
public const Int32 WM_MBUTTONDOWN = 0x207;
// Override the default message processing to add
// the new event.
protected override void WndProc(ref Message ThisMsg)
{
// See which message Windows has passed.
if ((ThisMsg.Msg == WM_MOUSEWHEEL) ||
(ThisMsg.Msg == WM_MBUTTONDOWN))
{
// Fire the event.
ThisSDCheck.Invoke(this, null);
return;
}
base.WndProc(ref ThisMsg);
}
public Form1()
{
InitializeComponent();
// Add the event handler to the event.
ThisSDCheck += new DoSDCheck(HandleShutdown);
}
}
}