Page 1 of 1
Detecting middle mouse button?
Posted: Thu Feb 19, 2004 12:16 pm
by PB
My Microsoft IntelliMouse has finally died so I've had to use an old serial
mouse again.

It has 3 buttons, but the middle one is unrecognized by
Windows. Is there a way to detect it via hardware somehow? I've tried
using GetAsyncKeyState with #VK_MBUTTON but it always reports 0...
Edit: Also, there are NO drivers for it that work with Windows 2000.
Posted: Mon Jul 18, 2005 4:51 pm
by DoubleDutch
Sorry for the late answer: (!!!)
In the mouse options in control panel, you can set it so that it acts as a middle button.
Posted: Mon Jul 18, 2005 9:57 pm
by PB
> Sorry for the late answer: (!!!)
Hehehe, I've sinced upgraded to Win XP and have a Logitech mouse.
> In the mouse options in control panel, you can set it so that it acts as a
> middle button
That wasn't an option when I had my problem -- only the left/right mouse
buttons were available in the Mouse applet in the Control Panel, which is
why I was wondering if I could detect the middle one via hardware. But
it's no longer an issue.

Posted: Mon Jul 18, 2005 10:41 pm
by DoubleDutch
That must have been on an early driver (latest drivers are somewhere on MS website - but its a bit of a maze)...
-Anthony
Posted: Mon Jul 18, 2005 11:28 pm
by PB
> That must have been on an early driver
I was running a standard Win 2000 Pro install with Service Pack 4... and
no middle mouse button support at all. As you said, I couldn't find any
updated drivers on Microsoft's site -- it sure is a maze!

Posted: Tue Jul 19, 2005 12:04 am
by Psychophanta
PB, doesn't it work in normal operation in windows?
I think if windows can detect 3rd button, there must be an API funtion to do it

Else i bet that you will not get it to work without a driver
However, usually Microsoft products are the less compatible with Microsoft windows

Posted: Tue Jul 19, 2005 12:14 am
by DoubleDutch
If you have a middle button then you can read it with:
Code: Select all
If GetAsyncKeyState_(#VK_MBUTTON)
MButton=#True
Else
MButton=#False
EndIf
or
Code: Select all
if WindowEvent()=#WM_MButtonDown
...
Both work without problems...

Posted: Tue Jul 19, 2005 1:42 am
by PB
> PB, doesn't it work in normal operation in windows?
No, it didn't. Even with a fresh W2K Pro install with SP4, the middle mouse
button wasn't recognized. The mouse wasn't faulty -- it worked fine on a
different PC. So it definitely needed a driver that I couldn't find at the time.
> If you have a middle button then you can read it with [#VK_MBUTTON]
I already tried that, but it didn't work. I don't know why, it was one of the
first tricks I tried when I had to start using that mouse. Very bizarre!
