Sign in to follow this  

problem with getcursorpos

This topic is 4865 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

I have a fullscreen directx application and am trying to get the coordinates of the cursor. POINT point; GetCursorPos(&point); does not work. I would prefer not to use directinput just to get mouse coordinates. Any idea why getcursorpos does not work? Any help is appreciated. -Dev578

Share this post


Link to post
Share on other sites
In what way does it not work? What value does GetCursorPos() return, and what is your POINT structure filled with?

Share this post


Link to post
Share on other sites
Trying to figure that out myself. point.x and point.y are not integers, I try to print it out to the screen:

sprintf(&String,"point.x: %i point.y: %i",point.x,point.y);
e_font->DrawTextA(NULL,&String,1,&font_rect,DT_LEFT|DT_NOCLIP,0xFFFFFFFF);

and nothing happens. It is definately something though, because after the call to getcursorpos:

if (point.x)

returns true, meaning it equals something. Any ideas?

-Dev578

Share this post


Link to post
Share on other sites
Use the debugger. Find out what's being put in the struct. And find out what SetCursorPos() is returning.

Share this post


Link to post
Share on other sites
Quote:
Original post by dev578
sprintf(&String,"point.x: %i point.y: %i",point.x,point.y);


You should use %d for integers and %ld for longs (POINT uses longs). So try:


char String[256];
sprintf(String,"point.x: %ld point.y: %ld",point.x,point.y);

and see if you get any better output.

Share this post


Link to post
Share on other sites

This topic is 4865 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