Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulate mouse click for side buttons

Tags:

c++

c#

mouse

I am aware of how to use mouse_event to simulate a mouse click for the left or right buttons. What I would like to know is if this function or another in C#/C++ allows you to simulate the mouse4 or mouse5 buttons that gaming mice have?

like image 514
John Avatar asked Dec 10 '12 14:12

John


People also ask

How do you simulate left mouse click on keyboard?

Step 2 Move the mouse pointer left and right by pressing “4” and “6” on the numeric keypad. Press “8” and “2” to move the pointer up or down. The “1”, “3”, “7” and “9” keys move the mouse pointer diagonally. Step 3 Simulate a left mouse click by pressing “5." Press “+” to double-click.

Can you use mouse side buttons?

Many new computer mice also have buttons on the side of the mouse. These buttons can be programmed to do anything. However, by default, the left-thumb button can go back on a web page.


1 Answers

mouse4 and mouse5 in windows are named xbutton1 and xbutton2

You can use these:

mouse_event(MOUSEEVENTF_XDOWN, NULL, NULL, XBUTTON1, NULL);
mouse_event(MOUSEEVENTF_XDOWN, NULL, NULL, XBUTTON2, NULL);
mouse_event(MOUSEEVENTF_XUP, NULL, NULL, XBUTTON1, NULL);
mouse_event(MOUSEEVENTF_XUP, NULL, NULL, XBUTTON2, NULL);
like image 73
MJavad Avatar answered Oct 31 '22 16:10

MJavad