Original Post
Hello! I think I already had this problem some time ago but ah well, have it again and I don,t know what to do. The problem is that I cannot get and accurate mouse position using WM_MOUSEMOVE messages. The mouse position is accurate in the topleft window corner but doesn't follow the mouse to the bottomright corner so I notice an offset. Here's what happens with my WM_MOUSEMOVE, I know a lot of stuff that looks strange happens, because the code goes through a lot of functions that modify the point, I've summarized it here : Now in my window :
POINT p;
p.x = LOWORD(lparam);
p.y = HIWORD(lparam);
// I know the following is stupid, simply it happens in different parts of code
// That's the way my engine is made :P, It shouldn't do anything anyway
// And I've tryed doing it without these lines
::ClientToScreen(hwnd, &p);
::ScreenToClient(hwnd, &p);
// Change to a lower-left origin
RECT rect;
::GetClientRect(hwnd, ▭);
p.y = rect.bottom-rect.top - p.y;
1----------------2
| f|
| |
| |
| |
| |
3----------------4
When the windows mouse is at point 3, My program has the right position. However, when the mouse is at point 2, My program has the position "f". There is an offset between the windows cursor and the position my program receives. My program has (790,573) when it should have (800,600). Hope I was clear!