Re: Raw Input from Mouse-like HID device
From: Simon King (sking_at_please.no.spam.whiskyalpha.com)
Date: 11/18/04
- Next message: Christian Verdani: "wireless signal strength"
- Previous message: Philippe Auphelle: "Re: Configuring port monitor UI DLL programmatically?"
- In reply to: Ray Trent: "Re: Raw Input from Mouse-like HID device"
- Next in thread: Ray Trent: "Re: Raw Input from Mouse-like HID device"
- Reply: Ray Trent: "Re: Raw Input from Mouse-like HID device"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 18 Nov 2004 10:35:10 +0000
Unfortunately, calling EnumDevices (passing DIEDFL_ALLDEVICES) only
gives two devices, the system keyboard and system mouse. If I pass
DIEDFL_INCLUDEALIASES, I get 3 mice and 3 keyboards, whether my USB HID
device is plugged in or not. Acquiring any one of them exclusively
causes the mouse cursor to disappear, and once it is gone I don't seem
to be able to generate normal mouse events even using the mouse_event
function.
I don't think I explained exactly what I wanted to do at the beginning
of this thread, so I'll try and do that now. I have two input devices -
a touch screen and a 'control stick' (I don't know what else to call it
- it's like the tiny joystick things that used to be on laptop keyboards
before touchpads became popular). Both are USB HID devices, and both
work fine when controlling the cursor normally.
However, I want the touchscreen to control the cursor, but the control
stick to control a different function in my application (although I also
want the ability to toggle this behaviour so that when necessary, the
control stick moves the mouse cursor)
Summary of what I have tried so far, (in case anyone other than Ray is
reading :-) ):
Raw Input: This would allow me to distinguish between the different
devices, but it wouldn't let me stop the control stick from moving the
mouse cursor.
DirectInput: This would not let me treat the devices independently
(because they both get merged into the 'system mouse' device)
I have even tried a nasty kludge using raw input, detecting that the
device that moved the mouse was the control stick, and moving the cursor
back to the original position again, but this made the cursor 'wobble'
on the screen, and was generally a bit nasty. It also probably wouldn't
work very well if the user tried to use both devices at the same time.
It's looking like I'm going to need a mouse filter driver so I'm
ordering the DDK, but since I've never done that before (and I imagine
it's not particularly easy) I was trying to explore all other avenues
first. Is there perhaps another newsgroup which would be more suitable
for this question?
Thanks again,
Simon
Ray Trent wrote:
> Hmmm. I always assumed that the "system mouse" abstraction was there as
> a convenience for people just wanted to receive all mouse input.
>
> Again, I've never tried this, but you may be able to open the device by
> enumerating it with EnumDevices, and specifying the appropriate handle
> rather than specifying GUID_SysMouse when you call CreateDevice.
>
> However, it may be that the system doesn't let you open a mouse
> seperately from DirectInput and only allows access via GUID_SysMouse...
> not sure... Of course, in that case it may also be the case that getting
> exclusive access also won't stop cursor motion...
>
> Failing all of this, a mouse filter driver will probably be the only way
> to go. More complicated, but you can do anything there.
>
- Next message: Christian Verdani: "wireless signal strength"
- Previous message: Philippe Auphelle: "Re: Configuring port monitor UI DLL programmatically?"
- In reply to: Ray Trent: "Re: Raw Input from Mouse-like HID device"
- Next in thread: Ray Trent: "Re: Raw Input from Mouse-like HID device"
- Reply: Ray Trent: "Re: Raw Input from Mouse-like HID device"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|