   Direct Input Mouse Wraps Around Screen
  I wrote code to stop the mouse from going beyond the boundaries of the screen. It stops on the bottom (and right), but when it hits the top (and left) it pops out on the opposite side.Here is the code:mousePos.y=(DWORD)mousePos.y+objectData.didod.dwData;if(mousePos.y>767)mousePos.y=767; //767= (the width)-1if(mousePos.y<0)mousePos.y=0;Its the same with x (but with 1023 instead of 767).If I comment out the 3rd line, it works the same way. I believe that this means that whenever (DWORD)mousePos.y+objectData.didod.dwData is below 0, mousePos.y goes above 767. I think it may have something to do with the type of mousePos.y being float, as mousePos is a D3DVECTOR3. How do I fix it?