[C++] 纯文本查看 复制代码 #include <windows.h>
LRESULT CALLBACK MouseWheel(int nCode, WPARAM wParam, LPARAM lParam)
{
int wData;
if (nCode >= 0 && wParam == WM_MOUSEWHEEL)
{
wData = (int)(((MSLLHOOKSTRUCT *)lParam)->mouseData);
if (wData < 0)
{
keybd_event(VK_DOWN, 0, 0, 0);
// keybd_event(VK_UP, 0, 0, 0);
}
return true;
}
return CallNextHookEx(NULL, nCode, wParam, lParam);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
SetWindowsHookEx(
WH_MOUSE_LL,
MouseWheel,
hInstance,
NULL
);
MSG Msg;
GetMessage(&Msg, NULL, 0, 0);
return 0;
} |