Mouse events

Started by
1 comment, last by Maddibob 19 years, 1 month ago
Hello I have a normal MFC MDI setup with a Direct X8 swap chain controlling views to each window. I use an LPDIRECTINPUTDEVICE8 pointer for my mouse and when the rigth mouse button is pressed, I call Acquire(), do some movement actions and then Unacquire(). This all works nicely and I can move the mouse continually forward without Windows stopping it at the top of the screen... The problem is that whilst the mouse is acquired, you can click on the left mouse button which will still send events to Windows. This becomes apparent when you click and hold the left mouse button whilst the right mouse button is already held (my program allows you to move and drag things with both or either of the mouse buttons) - if you click and drag the left button whilst on the title bar of the window, once you Unacquire() the mouse, Windows kicks in and moves the window. This is obviously not what I want, so is there any way of disabling Windows messages whilst the mouse is acquired? I can pass a flag down to the underlying framework (CMDIChildWnd, etc) to let it know I have control of the mouse, but I can't seem to find anything. Any help would be gratefully received. Thanks
Advertisement
Try calling the IDirectInputDevice8::SetCooperativeLevel() method with the DISCL_EXCLUSIVE flag set. This prevents windows from using the mouse while it is acquired.
Hack my projects! Oh Yeah! Use an SVN client to check them out.BlockStacker
Thanks, Staffan, that's working perfectly now.

Regards
Rob

This topic is closed to new replies.

Advertisement