Swap mouse button

Code to swap the mouse button's action



using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace MouseSwap

/// Summary description for Class1.
///

class Class1
{
[DllImport("user32.dll")]
static extern bool SwapMouseButton(bool fSwap);

///

/// The main entry point for the application.
///

[STAThread]
static void Main(string[] args)
{
bool b;
using(System.Threading.Mutex m=new
System.Threading.Mutex(true,
"ajai_myname_is Different _guid",out b))
{
if(!b)
{
MessageBox.Show("An Instance Already Runnig!","Error",
MessageBoxButtons.OK,MessageBoxIcon.Stop);
return;
}
   Console.WriteLine("Swapping Primary Button From {0}",System.Windows.Forms.
SystemInformation.MouseButtonsSwapped?"Right to Left":"Left to Right");
   SwapMouseButton(!System.Windows.Forms.SystemInformation.
MouseButtonsSwapped);
   Console.WriteLine("Swapped\n\a\a \t \n Developed by Ajai NP");
}}
}
}
--keep posing

Comments

Popular posts from this blog

Fedora 32 Setting up Citrix workspace client

Probing element in app.config + Post build event to copy multiple files

List of useful tools(Must have tools/Application)