c++ - Get Mouse Wheel movement data -
i have wrote window hook retrieve mouse events
_handle = setwindowshookex(wh_mouse, (hookproc)keyevent, nullptr, getcurrentthreadid()); static lresult winapi keyevent(int ncode, wparam wparam, lparam lparam) { if(ncode >= 0) { mousehookstruct* mstruct = ( mousehookstruct*)lparam; msllhookstruct* mwheeldstruct = (msllhookstruct*)lparam; cmousehookcom::_this->reporteventw(mstruct->hwnd, wparam, mwheeldstruct); } return(callnexthookex(null, ncode, wparam, lparam)); } case wm_mousewheel: outputdebugstring(l"cmousehookcom-wm_mousewheel"); strm = (msllhookstruct*)extradata; zdelta = (short)(hiword(((msllhookstruct*)extradata)->mousedata)); _stprintf(buffer, l"cmousehookcom - wm_mousewheel delta %d %i", zdelta, short((strm->mousedata >> 16) & 0xffff)); outputdebugstring(buffer); if (zdelta > 0) { outputdebugstring(l"cmousehookcom-wm_mousewheel up"); invoke_onscrollout(componentid); } else { outputdebugstring(l"cmousehookcom-wm_mousewheel down"); invoke_onscrollin(componentid); } break; default: _stprintf(buffer, l"cmousehookcom - unhandleled event %d", event); outputdebugstring(buffer); break; }
no matter how try positive results of wheel. different value. correct way retrieve data?
you should use raw input instead of mouse hook. less overhead on os monitor mouse, , gives information hook not.
Comments
Post a Comment