Advertisement

Mouse

Started by September 16, 2000 11:03 AM
1 comment, last by SKSlayer 24 years, 2 months ago
I am using the win32 mouse system. I want my mouse to be "STUCK" in my window''s handle (I got my reasons to do that) So, when I go to the border, it does not go further any more ... What''s da solution ? Do I have to get my mouse position in in WM_PAINT and set it back when it''s out of bounds ? In that case, how do I : - Set the mouse to the position (Cannot find it in MSDN) - Get The height/width of my window and its top left corner position ? (I didn''t really seek for it, but, if you know ...) Is there any other solutions ?
(you can find me on IRC : #opengl on undernet)
You can use this...

        GLint x, y;RECT WndRect;POINT MousePos;GetWindowRect(&WndRect);GetCursorPos(&MousePos);if (MousePos.x < WndRect.Left)  x = WndRect.Left;else if (MousePos.x > WndRect.Right)  x = WndRect.Right;else  x = MousePos.x;if (MousePos.y < WndRect.Top)  y = WndRect.Top;else if (MousePos.y > WndRect.Bottom)  y = WndRect.Bottom;else  y = MousePos.y;SetCursorPos(x, y);        


There ya go. I hope you learn this instead of just copying and pasting....

S.

Edited by - Strylinys on September 16, 2000 4:22:31 PM
Advertisement
Yeah, I can learn without cutnpasting :o)
I hate cutnpaste

But just sometimes, I dunno have any ideo of how to do something


Thanks a lot
(you can find me on IRC : #opengl on undernet)

This topic is closed to new replies.

Advertisement