Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What messages correspond to extra mouse buttons?

Status
Not open for further replies.

timmay3141

Programmer
Dec 3, 2002
468
US
I have a mouse with side buttons that, when pressed, do the same thing as the forward and back buttons on the internet. You can also make them to do other things if you want to. I was wondering, what windows messages correspond to the pressing of these buttons? I'd like to be able to use them in a program I'm writing.
 
If you have Visual Studio you can use the Spy ++ application to see what messages are being sent when you click the buttons.
 
Spy++ is just giving me a bunch of WM_KICKIDLE messages - it gives me either 6 or 8 of them, but it seems to choose randomly how many to send. This doesn't really help, but thanks for letting me know about Spy++, I'm sure I'll use it in the future.
 
Buttons 4 and 5 are referred to XBUTTON1 and XBUTTON2 and, so far as I am aware, are only supported in Win2000 ->

The window manager supports XBUTTON1 and XBUTTON2 through the WM_XBUTTON and WM_NCXBUTTON messages. The HIWORD of the WPARAM in these messages contains a flag indicating which X button was pressed.

So, as per standard mouse messages , you will now get messages for

WM_NCXBUTTONDBLCLK
WM_NCXBUTTONDOWN
WM_NCXBUTTONUP
WM_XBUTTONDBLCLK
WM_XBUTTONDOWN
WM_XBUTTONUP

Finally, if you are hooking the mouse procedure within the application you must use MOUSEHOOKSTRUCTEX in place of MOUSEHOOKSTRUCT to receive messages from the XBUTTONS.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top