5 button mouse
- Blue Steel
- Enthusiast
- Posts: 132
- Joined: Wed Aug 31, 2005 4:49 pm
- Contact:
5 button mouse
I have a 5 button mouse .. can someone plz tell me how i can read when i've pressed one of them.. and so that it tells mew which one.. I know i can do it for 3 but how about the other 2 (and also combinations there of)
Currently using PureBasic 4.51(x86)
http://www.codingmonkeys.com
Covers many languages including PureBasic

Covers many languages including PureBasic
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
Re: 5 button mouse
Is it a CAD mouse or a programmable mouse?
CAD mouse you probably just have to scan for inputs... programmable mouse it would be handled by the driver of that mouse!
I have a logitech gaming mouse with 4 buttons and a roller... all set uppable in the mouse icon under control panel as I installed the driver.
CAD mouse you probably just have to scan for inputs... programmable mouse it would be handled by the driver of that mouse!
I have a logitech gaming mouse with 4 buttons and a roller... all set uppable in the mouse icon under control panel as I installed the driver.
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: 5 button mouse
You can use the API commands such as GetAsyncKeyState()
Microsoft has some constants:
VK_LBUTTON Left mouse button
VK_RBUTTON Right mouse button
VK_MBUTTON Middle mouse button (three-button mouse)
VK_XBUTTON1 (0x05) X1 mouse button
VK_XBUTTON2 (0x06) X2 mouse button
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Microsoft has some constants:
VK_LBUTTON Left mouse button
VK_RBUTTON Right mouse button
VK_MBUTTON Middle mouse button (three-button mouse)
VK_XBUTTON1 (0x05) X1 mouse button
VK_XBUTTON2 (0x06) X2 mouse button
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
- Blue Steel
- Enthusiast
- Posts: 132
- Joined: Wed Aug 31, 2005 4:49 pm
- Contact:
Re: 5 button mouse
Thanks for the info, can you write an example please
I've never been able to get api calls to weork properly for me from in PureBasic.. I've always stuffed them up
I've just been searching the net since i posted that message.. i've found out that you need to use
DIMOUSESTATE2 (reports up to 8 buttons) as opposed to DIMOUSESTATE (reports 4 buttons)
so maybe just might need a tweak in the compiler ( hint.. for future release of PureBasic) that is if Pure basic is using those routines

I've just been searching the net since i posted that message.. i've found out that you need to use
DIMOUSESTATE2 (reports up to 8 buttons) as opposed to DIMOUSESTATE (reports 4 buttons)
so maybe just might need a tweak in the compiler ( hint.. for future release of PureBasic) that is if Pure basic is using those routines
Currently using PureBasic 4.51(x86)
http://www.codingmonkeys.com
Covers many languages including PureBasic

Covers many languages including PureBasic
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: 5 button mouse
Something like this:
PB may even 'know' the VK_XBUTTONs already, I don't know as I only have a 3-button mouse. There are other 'OEM' constants that could also be used for mouse button input, so a little bit of experimenting and perhaps a manufacturer's guide will be necessary.
Code: Select all
Procedure ShowWin()
If OpenWindow(0, 0, 0, 500, 500, "Mouse Clicks", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) : EndIf
EndProcedure
Procedure WaitForUser()
;----------------------
iEvent.i = 0
iGdgID.i = 0
#VK_XBUTTON1 = $05
#VK_XBUTTON2 = $06
Repeat ; Start of the event loop
iEvent = WaitWindowEvent(1)
If GetAsyncKeyState_(#VK_LBUTTON) & 1 : Debug "Left Mouse Clicked" : EndIf
If GetAsyncKeyState_(#VK_RBUTTON) & 1 : Debug "Right Mouse Clicked" : EndIf
If GetAsyncKeyState_(#VK_MBUTTON) & 1 : Debug "Middle Mouse Clicked" : EndIf
If GetAsyncKeyState_(#VK_XBUTTON1) & 1 : Debug "X1 Mouse Clicked" : EndIf
If GetAsyncKeyState_(#VK_XBUTTON2) & 1 : Debug "X2 Mouse Clicked" : EndIf
Until iEvent = #PB_Event_CloseWindow
EndProcedure
ShowWin()
WaitForUser()
End
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: 5 button mouse
Your example works fine on the System I'm working on right now :IdeasVacuum wrote:..., I don't know as I only have a 3-button mouse.
- WinXP-SP3, x86
- 5-Button Mouse (Raptor LM1 - standard MS-Driver, Version: 5.1.2600.0, Date: 01.07.2001)
[Dynamic-Dialogs] - create complex GUIs the easy way
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)
- Blue Steel
- Enthusiast
- Posts: 132
- Joined: Wed Aug 31, 2005 4:49 pm
- Contact:
Re: 5 button mouse
yup.. it works .. how about 7 button now 

Currently using PureBasic 4.51(x86)
http://www.codingmonkeys.com
Covers many languages including PureBasic

Covers many languages including PureBasic
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: 5 button mouse
..... the input devices are getting too complicated. I think at some time we will evolve and grow twice as many fingers just so we can use them.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
- Blue Steel
- Enthusiast
- Posts: 132
- Joined: Wed Aug 31, 2005 4:49 pm
- Contact:
Re: 5 button mouse
lol.. there are already mice out there with 15 buttons .. lol
but they are only for right handed ppl .. unfortunatly I only have a left hand which really makes things difficult and limiting me emensly which is why I need to be able to support what i have and can use and test
but they are only for right handed ppl .. unfortunatly I only have a left hand which really makes things difficult and limiting me emensly which is why I need to be able to support what i have and can use and test
Currently using PureBasic 4.51(x86)
http://www.codingmonkeys.com
Covers many languages including PureBasic

Covers many languages including PureBasic
Re: 5 button mouse
How can detect this keys in system global?
For example detect #VK_XBUTTON1 when press it in Firefox.
Unfortunately This code not working:
For example detect #VK_XBUTTON1 when press it in Firefox.
Unfortunately This code not working:
Code: Select all
#VK_XBUTTON1 = $05
#VK_XBUTTON2 = $06
Repeat ; Start of the event loop
If GetAsyncKeyState_(#VK_LBUTTON) & 1 : Debug "Left Mouse Clicked" : EndIf
If GetAsyncKeyState_(#VK_RBUTTON) & 1 : Debug "Right Mouse Clicked" : EndIf
If GetAsyncKeyState_(#VK_MBUTTON) & 1 : Debug "Middle Mouse Clicked" : EndIf
If GetAsyncKeyState_(#VK_XBUTTON1) & 1 : Debug "X1 Mouse Clicked" : EndIf
If GetAsyncKeyState_(#VK_XBUTTON2) & 1 : Debug "X2 Mouse Clicked" : EndIf
Delay(1)
Forever