I\'m repeating a question from another forum, as I\'d like the same answer.
From MSDN\'s SwapMouseButton Function.
How do I pass boolean data from
Thanks so much for the C# solution. It worked like a charm.
I made a slight alteration so that I could simply click on a desktop short-cut to toggle the primary mouse button, without passing in arguments. In case my approach helps someone else, here is that version:
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
}
}
}