Sign in to follow this  

DirectInput and Windowed Mouse

This topic is 3861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Currently have an application that I want to make possible to be windowed instead of fullscreen. Problem being that the GetCursorPos() grabs the fullscreen's position of the mouse. Have tried to offset this by using the GetWindowRect() but this only corrects to the point of the window, so the mouse position is still out by the border of the window. Is there a way to still use this method of grabbing the mouse position but correcting it to the positioning of the window's display frame?

Share this post


Link to post
Share on other sites
GetClientRect seems to be returning the dimensions of the frame...as in the left is always at 0 and the right is always (in this example) 632. Does not give its position over the screen..or even compared to its own window.

Share this post


Link to post
Share on other sites
Ooooh, that worked wonders.

Oh and it had/has to do with DirectInput because DirectInput is being used for the keyboard and the mouse clicks (at moment) Also the mouses movement used to be checked by DI, just had not realised that I had moved it completely under the Win API code.

Share this post


Link to post
Share on other sites
Quote:
Original post by TamGarTrinKi
Ooooh, that worked wonders.

Oh and it had/has to do with DirectInput because DirectInput is being used for the keyboard and the mouse clicks (at moment) Also the mouses movement used to be checked by DI, just had not realised that I had moved it completely under the Win API code.


A little off topic, but Microsoft actually recommends against using DirectInput for keyboard and mouse input. The Win32 functions work better for keyboard input (Since you don't have to do the upper to lower case transition and so on) and mouse input (Pointer ballistics).

Share this post


Link to post
Share on other sites
Current program is regarding mostly 2D board games and the such, where uppercase/lowercase will not be an issue at any point. (At present moment the keyboard itself has very little to do with it as well, *point, click, point, click*).

Share this post


Link to post
Share on other sites

This topic is 3861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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