Thứ Năm, 28 tháng 2, 2008

Using API

using System.Runtime.InteropServices;

namespace SwapMouseEg {

class SwapMouse {
[DllImport("user32.dll")]
public static extern Int32 SwapMouseButton(Int32 bSwap);
}
}

//Form
private void btnSwap_Click(object sender, EventArgs e)
{
SwapMouse.SwapMouseButton(1);
}
private void btnReset_Click(object sender, EventArgs e) {
SwapMouse.SwapMouseButton(0);
}
//Class
using System.Runtime.InteropServices;
namespace SwapMouseEg {
class SwapMouse {
[DllImport("user32.dll")]
public static extern Int32 SwapMouseButton(Int32 bSwap);
}
}
//Form
private void btnSwap_Click(object sender, EventArgs e)
{
SwapMouse.SwapMouseButton(1);
}
private void btnReset_Click(object sender, EventArgs e) {
SwapMouse.SwapMouseButton(0);
}

Không có nhận xét nào: