Use SystemParametersInfo function with SPI_SETMOUSEBUTTONSWAP parameter.
procedure TForm1.Button1Click(Sender: TObject); begin SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 1, nil, 0); end; procedure TForm1.Button2Click(Sender: TObject); begin SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 0, nil, 0); end;