Mouse Hook and DirectInput

Mouse Hook and DirectInput

Post by Jan Pu » Wed, 09 Jul 2003 17:09:14



Hi all,

what I'm trying to do is to prevent windows(XP) from doing a MouseMove.
How I tried programming this is by making a message hook to intercept
the MouseMove messages by creating a hook to the WH_MOUSE_LL
messagequeue. Then I used DirectInput to get raw mouse data so I can
move the cursor by code, but with a speed I can control myself. Any
suggestions because when I install the message hook, windows still moves
my cursor, even if I do not pass the WM_MOUSEMOVE messages to the next
hook in the chain.

Thanks in advance,

Jan

 
 
 

Mouse Hook and DirectInput

Post by Larry Serflate » Wed, 09 Jul 2003 18:00:16



Quote:> Hi all,

> what I'm trying to do is to prevent windows(XP) from doing a MouseMove.
> How I tried programming this is by making a message hook to intercept
> the MouseMove messages by creating a hook to the WH_MOUSE_LL
> messagequeue. Then I used DirectInput to get raw mouse data so I can
> move the cursor by code, but with a speed I can control myself. Any
> suggestions because when I install the message hook, windows still moves
> my cursor, even if I do not pass the WM_MOUSEMOVE messages to the next
> hook in the chain.

I don't do mice, but I would think that MOVE message is a notification,
not a request.  IOW, Windows is telling that app the mouse has moved, it is
not sending a request to move it.

If I were looking to hold the cursor, or move it on demand, I would
look at the ClipCursor API to restrict the mouse, and SetCursorPos to
move it.

HTH
LFS

 
 
 

Mouse Hook and DirectInput

Post by Jan Pu » Wed, 09 Jul 2003 18:51:00




>>Hi all,

>>what I'm trying to do is to prevent windows(XP) from doing a MouseMove.
>>How I tried programming this is by making a message hook to intercept
>>the MouseMove messages by creating a hook to the WH_MOUSE_LL
>>messagequeue. Then I used DirectInput to get raw mouse data so I can
>>move the cursor by code, but with a speed I can control myself. Any
>>suggestions because when I install the message hook, windows still moves
>>my cursor, even if I do not pass the WM_MOUSEMOVE messages to the next
>>hook in the chain.

> I don't do mice, but I would think that MOVE message is a notification,
> not a request.  IOW, Windows is telling that app the mouse has moved, it is
> not sending a request to move it.

> If I were looking to hold the cursor, or move it on demand, I would
> look at the ClipCursor API to restrict the mouse, and SetCursorPos to
> move it.

> HTH
> LFS

I think I found the sollution, because this seems to work: if you use a
WH_MOUSE_LL hook to catch the messages before they are sent to the
windows queue and I return 1 in the callback function so that windows
doesn't process the message anymore and then I use SetCursorPos to set
the cursor position. But thanks for the suggestions anyway,

Jan

 
 
 

1. Directinput with the mouse????

Has anyone achieved this????

I have seen the joystick implementation
with directx, but I need the mouse as the
input device...

If anyone has a code snippet, I would really
appreciate it.

I have looked at Hori's stuff,
but he didn't implement the mouse
in the joystick and the keyboard.

Thanks
Tony

remove the donotspam_ form the address above.

Thanks

2. Info on voxels

3. DirectInput and Visual Basic 5.0

4. Help me please, my software is confuse!!!!

5. directinput

6. WELCOME TO LIGHT ILLUSION!!!!

7. DirectInput code completion

8. Premiere LE vs Premiere 3

9. keyboard simulation and directinput

10. Problems with DirectInput

11. DirectInput linkage problem...

12. DirectInput Question