Direct Input / Win32 Window features

Started by
0 comments, last by MJP 16 years, 3 months ago
This is a simple question about directX/win32 input: In my application (C/C++), I acquire the mouse device with direct input in exclusive mode. Yet, I still want the user to be able to move their cursor outside of the window application. The idea is they don't see their cursor in the application's client window (I draw my own) but as soon as they leave the space to do things like maximize, minimize, move the window, restore, whatever... the normal windows cursor apears again at the right location. I hope this explanation makes sense. What I am really asking is how can I use direct input to get the mouse position (relative to the client window) without being in exclusive mode using direct input. Or is there a better way? Any help, as always, is greatly appreciated.
Advertisement
You're probably not going to like my suggestion, but I think its the best one: don't use DirectInput for mouse input. With regular Win32 messages, you'll be able show/hide the cursor however you want with no restrictions while still utilizing the regular GUI cursor. If ever need to switch to high-resolution input (perhaps for an FPS camera), you can use RawInput to get the data. DI really offers no advantages at all, and is in fact harder to setup/use. It also creates some extra overhead, since all it does is create a thread to read WM_INPUT messages. Your input system can be much more robust if you simply handle the messages yourself.

This topic is closed to new replies.

Advertisement