I have a side thread that gets the state of the gamepad, keyboard and mouse buttons 60 times per second (just like a regular game). To read the state of controller buttons I use the joyGetPosEx function, for keyboard and mouse buttons I use the GetKeyState function. The problem occurs with the wheel of the mouse, because the status of the wheel cannot be read with GetKeyState.
After the wheel is turned, the system sends a message to the window, this is processed in a loop, and the OnMouseWheel event is dispatched. The problem, however, is that the state of the mouse buttons is to be retrieved in a side thread (the form should have nothing to do with it), and the thread will not get this message about the rotation of the scroll.
I can just use the OnMouseWheel event to write/increment the delta in the custom form field, and the thread will read that value and reset the variable. But this is a fallback option because I don't like it — sounds dirty.
Anyone know of any way to read the mouse wheel delta without using a form message loop? Is it even possible?