using
System;
using
System.Collections.Generic;
using
System.Text;
using
System.Runtime.InteropServices;
namespace
SwapMouse
{
class
Program
{
[DllImport(
"user32.dll"
)]
private
extern
static
bool
SwapMouseButton(
bool
fSwap);
//博客地址:http://www.jqpress.com
[DllImport(
"user32.dll"
)]
private
extern
static
int
GetSystemMetrics(
int
index);
static
void
Main(
string
[] args)
{
int
flag = GetSystemMetrics(23);
//获取当前鼠标设置状态
if
(flag == 0)
//右手习惯
{
SwapMouseButton(
true
);
//设置成左手
}
else
//左手习惯
{
SwapMouseButton(
false
);
//设置成右手
}
}
}
}
时间: 2024-10-29 22:35:42