Original Post
I am cerating an interface for my OpenGL game, where people can drag things around. For now I am just using regular winproc messages, but eventually will use directinput. But I want to get everything working now, so I will ask the question. I want to draw the selected interface item starting where the mouse is, so in winproc I do:
int mousex = LOWORD(lParam);
int mousey = HIWORD(lParam);
mx = mousex;
my = mousey;
then I drew my selected interface item starting at mx by my. Which worked, until I got near the edge of my window. At which point the mouse pointer continued towards the edge, but the drawn item went to somewhere towards the middle of the window. Obviously, the item as not being drawn at the mouse position on those occasions. So to test it, I have my wondow now riting in the title box at the top the value of mx and my. They give the correct figures until the mouse gets to 33 pixels from the top. Then my suddenly has 512 in it until the cursor returns to 33 or more pixels from the top of the window. mx works the same way, once it gets to around 12 pixels from the left of the window, mx holds a figure which appears to be the distance of the window's left side from the left of the screen (so if I drag the window 200 px from the left of the screen, mx holds 200 once I get to around 11 pixels from the left of the window. I am really puzzled by why this is occuring, and really need to fix it, so that no matter where the mouse is within the window, mx and my have the correct figures. I appreciate any help. (I realize this isn't really an opengl problem, but I couldn't actually find the old win 32 sub-forum, I am most likely blind)