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 coordinatesPOINT 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 coordinatesScreenToClient(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