none
Mouse Buttons RRS feed

  • Question

  • Is there a way to make a script that swaps a mouse button. I've tried to one in the gallery, but it did not work. It's for demo purposes. Thanks!
    Friday, December 15, 2017 5:43 PM

Answers

  • I will remove the pain here.  The buttons cannot be swapped via registry edits without a logoff and logon.  The API takes effect immediately.

    $code = @'
    [DllImport("user32.dll")]
             public static extern bool SwapMouseButton(bool fSwap);
    '@
    Add-Type $code -Name Mouse -Namespace Utils
    $old = [Utils.Mouse]::SwapMouseButton($true)
    [Utils.Mouse]::SwapMouseButton($old)


    \_(ツ)_/

    Saturday, December 16, 2017 5:26 AM