Mouse Hook and DirectInput 
Author Message
 Mouse Hook and DirectInput

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



Sat, 24 Dec 2005 16:09:14 GMT  
 Mouse Hook and DirectInput

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



Sat, 24 Dec 2005 17:00:16 GMT  
 Mouse Hook and DirectInput

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

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



Sat, 24 Dec 2005 17:51:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Mhcallback - Keyboard hook and Mouse hook , HOW!

2. mouse click (hook?!)

3. System wide hook for Mouse and Keyboard events

4. Keyboard / Mouse Hook: "Decoding" wParam, lParam

5. Detecting mouse events using hooks

6. hooking kbd/mouse in VB

7. Using hooks to trap ANY mouse/keyboard event

8. Hooking the right mouse button in a text box

9. Subclassing/Hooks to detect Ctl+Right Mouse?

10. Strange Behavior with Thread-Wide Mouse Hook!

11. Using SetWindowsHookEX to hook Mouse messages

12. Mouse and Keyboard Hooking?

 

 
Powered by phpBB® Forum Software