Improved mouse swap Workaround

Like some others, I’ve started to get issues with the mouse button configuration (particularly when I tried out marksman, I’ve played ADC in League of Legends for far too long).

I didn’t like the whole reg-edit solution, since it usually requires a restart or can’t be changed while the program is open (which makes it very inconvenient when alt-tabbing or generally doing things on the side).

I’ve been fiddling around with the “change primary mouse button” setting in windows and was considering creating a mouse macro for this, but then I stumbled over an even more amazing solution:


Short version:
swapmouse.txt (3.5 KB)

  1. Download the attached swapmouse.txt
  2. rename it to swapmouse.exe

Long Diy version (which is also useful in case you don’t trust me):

  1. create a new text file
  2. paste the following code in
using System.Runtime.InteropServices;
using System;

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

    static void Main(string[] args)
    {
        int rightButtonIsAlreadyPrimary = SwapMouseButton(1);
        if (rightButtonIsAlreadyPrimary != 0)
        {
            SwapMouseButton(0);  // Make the left mousebutton primary
        }
    }
}
  1. save the file as swapmouse.cs (I’ve put mine into the Documents folder)
  2. open a console (press windows + R, type cmd).
  3. Navigate to the folder you put your file in using the cd command. If you’ve put your file into the Documents folder, type cd Documents, if it’s on the desktop type cd Desktop. If you’ve put it anywhere else you probably know what you’re doing
  4. run the following command
"%SystemRoot%\Microsoft.NET\Framework64\v3.5\csc" swapmouse.cs

This will give you a file called swapmouse.exe. Clicking this will swap your mousebuttons on the fly. I’ve put this file as a hotkey in my mouse software (on the “change DPI” button that I’ve never used anyway).

Shortcut to : ms-settings:mousetouchpad
Then select Left or Right primary. Then leave it open. Play the game.
Then you can just alt+tab to it to bring it to the top.

Little more simple.

I guess you can place both in favorites or the Taskbar.

Why not just setup profiles?