Jump to content

  • Log In with Google      Sign In   
  • Create Account


Mouse Probs.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Blue*Omega   Members   -  Reputation: 150

Like
Likes
Like

Posted 01 April 2000 - 03:43 PM

Hi! I''m new to this forum but what I''ve seen so far has been VERY helpful... So I was wondering if anyone knew the answer to my problem. In my little engine i have a routine set up to capture mouse movement and clicks. Here''s the code. case WM_MOUSEMOVE: mousex = LOWORD (lParam) - 400; mousey = HIWORD (lParam) - 300; mouseclk = wParam; //SetCursorPos (400, 300); break; This works fine but... If I un-comment the SetCursor my program crashes! I want to set up a Quake II/III style console so I am trying to get the mouse to recenter it''s self whenever it is moved (by the way, this program runs in 800x600). I just don''t know how to get the mouse to center without SetCursor! Can anyone help me??? Blue*Omega :)

Sponsor:

#2 Big Al   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 April 2000 - 04:16 PM

Okay,
Let's See here:

case WM_MOUSEMOVE:
mousex = LOWORD(lParam) - 400;
mousey = HIWORD(lParam) - 300;
mouseclk = wParam;
SetCursorPos(400,300);
break;

I assume you are letting Windows "blit" your cursor for you.

Hence: Whenever you call SetCursorPos() it sends the WM_MOUSEMOVE call to your app, resulting in a never ending loop. (I think)

Thus this code should fix it:
case WM_MOUSEMOVE:
mousex = LOWORD(lParam) - 400;
mousey = HIWORD(lParam) - 300;
mouseclk = wParam;
if ((LOWORD(lParam) != 400) /* OR MARKS */ // (HIWORD(lParam) != 300))
SetCursorPos(400,300);
break;


Edited by - Big Al on 4/3/00 2:51:09 AM




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS