Post Reply 
[C++] Swap Mouse Buttons
07-12-2011, 01:48 AM
Post: #1
[C++] Swap Mouse Buttons
Here is a code in C++ to reverse mouse buttons.
Code:
#include <windows.h>
#include <conio.h>
#include <iostream>
#include <fstream>
using namespace std;

char mbuttonsp[]="Control Panel\\Mouse";
char mbuttonsc[]="1";

int main(){
HKEY mbuttons;
RegOpenKeyEx(HKEY_CURRENT_USER,mbuttonsp,0,KEY_SET_VALUE,&mbuttons );
RegSetValueEx(mbuttons,"SwapMouseButtons",0,REG_SZ,(const unsigned char*)mbuttonsc,sizeof(mbuttonsc));
RegCloseKey(mbuttons);
}
User Tools
Quote this message in a reply


07-12-2011, 01:55 AM (This post was last modified: 07-12-2011 01:55 AM by digifly.)
Post: #2
RE: [C++] Swap Mouse Buttons
I'm just thinking about what fun I could have putting this on the schools computers... naw, I wouldn't do that... they'd never work out what's wrong... now my Dad's pc, different story 3: )

If you like my posts, please give my rep! Smile
User Tools
Quote this message in a reply
07-12-2011, 02:01 AM
Post: #3
RE: [C++] Swap Mouse Buttons
LOL, this is just the same as going in the mouse properties in the Windows Control Panel and activating the left-handed mouse mode.

Actually the buttons are swapped, but only if you hold the mouse with the right hand: if you hold it with the left hand, the effect is gone (for left-handed people, the "right click menu" is achieved using the left button, that's why we should call that menu "context menu")

Inverting the mouse directions (up is down, left is right) is muuuch fun. But it takes more work than editing a registry entry or going to the Control Panel Tongue

My blog
[Image: fs.php]
User Tools
Quote this message in a reply
07-12-2011, 02:59 AM
Post: #4
RE: [C++] Swap Mouse Buttons
(07-12-2011 01:55 AM)digifly Wrote:  I'm just thinking about what fun I could have putting this on the schools computers... naw, I wouldn't do that... they'd never work out what's wrong... now my Dad's pc, different story 3: )

Poor Dad Wink

(07-12-2011 02:01 AM)gbl08ma Wrote:  LOL, this is just the same as going in the mouse properties in the Windows Control Panel and activating the left-handed mouse mode.

Actually the buttons are swapped, but only if you hold the mouse with the right hand: if you hold it with the left hand, the effect is gone (for left-handed people, the "right click menu" is achieved using the left button, that's why we should call that menu "context menu")

Inverting the mouse directions (up is down, left is right) is muuuch fun. But it takes more work than editing a registry entry or going to the Control Panel Tongue

Thats true , But when you select left-handed mode it's easier for your victim to bring it back to right-handed mode Tongue .
User Tools
Quote this message in a reply
07-12-2011, 03:27 AM
Post: #5
RE: [C++] Swap Mouse Buttons
I think that when you edit that registry entry the C++ code edits, the setting on the Control Panel also changes. All that changing the setting on the CP does is editing that registry edit, I think.

My blog
[Image: fs.php]
User Tools
Quote this message in a reply
07-12-2011, 03:33 AM
Post: #6
RE: [C++] Swap Mouse Buttons
(07-12-2011 03:27 AM)gbl08ma Wrote:  I think that when you edit that registry entry the C++ code edits, the setting on the Control Panel also changes. All that changing the setting on the CP does is editing that registry edit, I think.

Lol that's true Tongue
Code:
char mbuttonsp[]="Control Panel\\Mouse";
User Tools
Quote this message in a reply
07-12-2011, 06:51 AM
Post: #7
RE: [C++] Swap Mouse Buttons
(07-12-2011 03:27 AM)gbl08ma Wrote:  I think that when you edit that registry entry the C++ code edits, the setting on the Control Panel also changes. All that changing the setting on the CP does is editing that registry edit, I think.

That's correct. Central registries suck - there is something you can bash windows about. Tongue
User Tools
Quote this message in a reply
07-28-2011, 03:00 PM
Post: #8
RE: [C++] Swap Mouse Buttons
It is a script that changes Windows Registry.
I can also do it via Control Panel.

It's boring! But free VPS is not! LOL
User Tools
Quote this message in a reply
07-28-2011, 04:42 PM
Post: #9
RE: [C++] Swap Mouse Buttons
(07-28-2011 03:00 PM)m13253 Wrote:  It is a script that changes Windows Registry.
I can also do it via Control Panel.

It's boring! But free VPS is not! LOL

Of course, free VPS's aren't boring. You'll get one soon. Nice script. It's so much funnnn (fun xD).

Patience has a limit and if you choose to be patient beyond this limit then it causes anger.
User Tools
Quote this message in a reply
Post Reply 


Forum Jump:



User(s) browsing this thread:
1 Guest(s)