In this question How to detect mouse wheel tilt an answer is posted and accepted that shows the code needed.
I've implemented that code in my application's existing WndProc
method (which is working for other messages I need to trap) but it's not working. I've checked and WndProc
doesn't appear to be getting any messages at all let alone ones with a value of 0x020E
when I tilt the mouse wheel.
I'm using a Microsoft Wireless Laser 5000 on Windows XP SP3 (fully patched) with .NET 3.5 SP1 installed.
I've updated my Intellipoint drivers to version 7.0.258.0 dated 08/05/2009.
Other applications (e.g. Visual Studio, Word, paint.NET) are getting and acting upon the mouse wheel being tilted so it must be my application, but I can't see what I'm doing wrong.
Just for completeness here's my code:
protected override void WndProc(ref Message m)
{
Trace.WriteLine(string.Format("0x{0:X4}", m.Msg));
switch(m.Msg)
{
case WM_EXITSIZEMOVE:
Opacity = 1.0;
break;
case WM_SYSCOMMAND:
int command = m.WParam.ToInt32() & 0xfff0;
if (command == SC_MINIMIZE && this.minimizeToTray)
{
MinimizeToTray();
}
break;
case WM_MOUSEHWHEEL:
// Handle tilting here
break;
}
base.WndProc(ref m);
}
The Trace.WriteLine
call is an attempt to check if the tilt messages are getting through. The other messages WM_EXITSIZEMOVE
and WM_SYSCOMMAND
are being received. The messages are defined as:
private const int WM_EXITSIZEMOVE = 0x0232;
private const int WM_SYSCOMMAND = 0x0112;
private const int SC_MINIMIZE = 0xF020;
private const int WM_MOUSEHWHEEL = 0x020E;
NOTE I removed the [hardware] tag, as I'm 99% sure it's not the hardware that's at fault as other applications are receiving the messages.
UPDATE
I've added a multi-line textbox with scrollbars to my application and that receives and acts upon the mouse wheel tilt messages. So all I need to do is find the code for that ;)
UPDATE
This question on SuperUser may have some bearing on this - I'll keep an eye on answers there.