Is there a way to disable the right-click button?
I'm trying to use a mouse hook, that just simply disables the right-click button when you run the program.
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <conio.h>
#define _WIN32_WINNT 0x0500
#define WM_RBUTTONDOWN 0x0204
#include <windows.h>
/* Disable mouse using low-level mouse hook */
HHOOK miHook;
//Starting Hook Procedure
LRESULT CALLBACK LowLevelMouseProc(int nCode, WPARAM wParam, LPARAM lParam) {
if (nCode == HC_ACTION) {
MSLLHOOKSTRUCT &msll = *(reinterpret_cast<MSLLHOOKSTRUCT*>(lParam));
if (wParam == WM_RBUTTONDOWN) {
cout << "OOO";
if (WM_RBUTTONDOWN) {
return -1; // Make this click be ignored
}
}
}
return CallNextHookEx(miHook, nCode, wParam, lParam);
}
int main() {
system("pause");
}
Is this the right approach, or do I need to actually go into the registry to actually disable the right-click on the mouse?