#include <Windows.h>
#include <iostream>
#pragma execution_character_set("utf-8")
HHOOK hook_fare;
LRESULT WINAPI fare_kontrol(int nCode, WPARAM wParam, LPARAM lParam) {
MSLLHOOKSTRUCT* pMouseStruct = (MSLLHOOKSTRUCT*)lParam;
if (nCode >= 0) {
switch (wParam) {
case WM_MOUSEMOVE: {
POINT fareKonum;
GetCursorPos(&fareKonum);
int fark_X = pMouseStruct->pt.x - fareKonum.x;
int fark_Y = pMouseStruct->pt.y - fareKonum.y;
SetCursorPos(pMouseStruct->pt.x, pMouseStruct->pt.y - fark_Y * 2);
return -1;
}
}
}
return CallNextHookEx(hook_fare, nCode, wParam, lParam);
}
int main() {
SetConsoleOutputCP(65001);
//ShowWindow(GetConsoleWindow(), SW_HIDE);
//Eğer konsol ekranının gözükmesini istemiyorsanız // işaretini kaldırın
hook_fare = SetWindowsHookEx(WH_MOUSE_LL, fare_kontrol, NULL, 0);
if (!hook_fare) {
std::cout << "Hook yüklenemedi!" << std::endl;
system("PAUSE");
exit(EXIT_FAILURE);
}
else {
std::cout << "Hook başarılı!";
}
MSG msg = { 0 };
while (msg.message != WM_QUIT) {
if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Sleep(1);
if (GetAsyncKeyState('C') & 0x8000) break;
//Farklı tuşlarla programı sonlandırabilirsiniz, bunun için && kullanarak aynı mantıkta kombinasyon sağlamak
}
UnhookWindowsHookEx(hook_fare);
return 0;
}