Re: Raw Input from Mouse-like HID device

From: Simon King (sking_at_please.no.spam.whiskyalpha.com)
Date: 11/18/04


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.
>



Relevant Pages

  • Re: Raw Input from Mouse-like HID device
    ... > work fine when controlling the cursor normally. ... > However, I want the touchscreen to control the cursor, but the control ... > I have even tried a nasty kludge using raw input, ...
    (microsoft.public.development.device.drivers)
  • Re: speech recognition & e-mail messages probs !!!
    ... To answer your question about mouse control and cursor control with ... say that is because I correspond regularly with someone who uses DNS ... cursor with voice control. ... speech recognition solutions and support. ...
    (microsoft.public.windows.vista.general)
  • Re: Positioning Cursor
    ... i do mean do set the position of the cursor. ... On a Form I have a Control, positioned let's say at 4 cm from the ... 7th or 8th entry in the list although no entry is ... ' If LeaveFocus is True, the focus will be returned to ...
    (microsoft.public.access.modulesdaovba)
  • Re: Documentation, anyone?
    ... password field and a "submit" button, and if the user hits the key ... Nope..actually the "enter" event is when the cursor moves into the ... control/field. ...
    (microsoft.public.access.modulesdaovba)
  • Re: aligning a welded-on nut with existing threads?
    ... seen some PC keyboards, made by NorthGate, which have a switch to change ... What these keyboards have which would be ... helpful to you is that the caps-lock key is down where Control is on a ... and the control key is directly to the left of 'A'. ...
    (rec.crafts.metalworking)

Loading