Jump to content
  • Advertisement
Sign in to follow this  

WINAPI Mouse movement diff via WinAPI

Recommended Posts

Hi all,

I want to obtain the mouse movement win WINAPI. Basically if the cursor is on the left side of the screen and I move the mouse left, I want to sill get a -x value.
I know that this was possible with DirectInput, but I cannot find a WinAPI equivalent. Is there any?

Share this post


Link to post
Share on other sites
Advertisement

Yeah, Raw Input does but you still need to get the mouse initial position by WINAPI call GetCursorPos unless you now the direction but do not now the position of your cursor

Share this post


Link to post
Share on other sites

GetRawInputData actually gives your the mouse motion in the X/Y directions, you can call it in response to a WM_INPUT event, after making sure to call RegisterRawInputDevice so that your window actually receives the events.

https://msdn.microsoft.com/query/dev15.query?appId=Dev15IDEF1&l=EN-US&k=k(WINUSER%2FGetRawInputData);k(GetRawInputData);k(SolutionItemsProject);k(DevLang-C%2B%2B);k(TargetOS-Windows)&rd=true

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!