C # switch between the left and right mouse keys without modifying them on the control panel

Source: Internet
Author: User

I always like to use the mouse with the left hand, But sometimes my colleagues will temporarily perform operations and have to make changes in the control panel. this is inconvenient. Why not write a console program and double-click it to switch between the left and right keys?
The code is simple: Copy codeThe Code is as follows: 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); // get the current mouse setting status
If (flag = 0) // right hand habits
{
SwapMouseButton (true); // set it to the left hand
}
Else // left hand habits
{
SwapMouseButton (false); // set it to the right hand
}
}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.