C's habit of switching mouse buttons does not require modification in the control panel
- 2020-05-09 19:05:57
- OfStack
I 1 like left hand to use the mouse, but sometimes colleagues will temporarily operate, but also have to change in the control panel, more inconvenient, why not write a console program, double click 1 can switch left and right keys
The code is simple:
The code is simple:
class Program
{
[DllImport("user32.dll")]
private extern static bool SwapMouseButton(bool fSwap);
// Blog address: http : //blog.csdn.net/bluceyoung
[DllImport("user32.dll")]
private extern static int GetSystemMetrics(int index);
static void Main(string[] args)
{
int flag = GetSystemMetrics(23);// Gets the current mouse Settings state
if (flag == 0)// The right habits
{
SwapMouseButton(true);// Set it to the left hand
}
else// lefthanded
{
SwapMouseButton(false);// Set it to the right hand
}
}
}