Jump to content

  • Log In with Google      Sign In   
  • Create Account

mouse input question


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
20 replies to this topic

#21 merlin9x9   Members   -  Reputation: 174

Like
Likes
Like

Posted 12 July 2001 - 08:46 AM

It does?! I've never heard of that happening, even when DirectInput happens to be initialized in the same app, because it's one of those functions that's always safe to call. Are you positive that it's GetCursorPos that's causing the crash?

This is the code I've used to get the mouse position relative to the origin of my game window's client area:

  
// this bit just gets the mouse position in screen coordinates

POINT curr_pos;
GetCursorPos(&curr_pos);

// hwnd is the handle to my game's main window

// this function will transform the screen coordinates of the mouse to window coordinates

ScreenToClient(hwnd, &curr_pos);


That should do it right there, and it should always be safe to do, assuming that your window has been created prior to the call and you give ScreenToClient a valid window handle.

If you're still having problems, perhaps you could post some code?


Edited by - merlin9x9 on July 12, 2001 3:53:13 PM

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS