Detecting middle mouse button?

For everything that's not in any way related to PureBasic. General chat etc...
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Detecting middle mouse button?

Post 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.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post 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.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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. :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post 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
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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! :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post 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 :P :o
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post 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... :)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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! :shock:
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Post Reply