I am very curious to know how does the 2-way communication happen in case of keyboard.
What i mean to say is… I have come across a toggle key application which can toggle the numlock, capslock… keys from the application. If the keyboard and mouse are opened exclusively by the operating system, how does this application get the handle to write to the device or even communicate to the device…
Is it possible to incorporate the similar kind of functionality of glowing light in case of mouse too? if so wat is the way to approach this problem…
User-mode applications can use SendInput to synthesize keystrokes, including caps, num & scroll lock.
Kbdclass is the class driver which reports keyboard events to the Win32 subsystem.
If an application injects a lock keystroke, the subsystem changes the indicator LEDs by sending an IOCTL_KEYBOARD_SET_INDICATORS device control request to all keyboard device stacks.
I am very curious to know how does the 2-way communication happen in case of keyboard.
What i mean to say is… I have come across a toggle key application which can toggle the numlock, capslock… keys from the application. If the keyboard and mouse are opened exclusively by the operating system, how does this application get the handle to write to the device or even communicate to the device…
Is it possible to incorporate the similar kind of functionality of glowing light in case of mouse too? if so wat is the way to approach this problem…
I am very curious to know how does the 2-way communication happen in case of keyboard.
What i mean to say is… I have come across a toggle key application which can toggle the numlock, capslock… keys from the application. If the keyboard and mouse are opened exclusively by the operating system, how does this application get the handle to write to the device or even communicate to the device…
There is a pre-defined Windows API to toggle these LEDs –
SetKeyboardState. It doesn’t require any kind of direct communication
with the device.
Is it possible to incorporate the similar kind of functionality of glowing light in case of mouse too? if so wat is the way to approach this problem…
Not in the same way, because there are no predefined APIs to do it. It
has already been suggested to you, I believe, that you create a separate
HID collection for this kind of control. That won’t be claimed by the
standard driver, so your application can tweak it.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
> I am very curious to know how does the 2-way communication happen in case of keyboard.
>
> What i mean to say is… I have come across a toggle key application which can toggle the numlock, capslock… keys from the application. If the keyboard and mouse are opened exclusively by the operating system, how does this application get the handle to write to the device or even communicate to the device…
>
>
There is a pre-defined Windows API to toggle these LEDs –
SetKeyboardState. It doesn’t require any kind of direct communication
with the device.
This was misleading. Allow me to clarify. “It doesn’t require any kind
of direct communication with the device BY THE APPLICATION.” Of course,
the SetKeyboardState API has to communicate with the device, using the
exclusive handle that the operating system already knows about.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
> Is it possible to incorporate the similar kind of functionality of glowing light in case of mouse too? if so wat is the way to approach this problem…
Try the “firefly” sample. I particularly enjoyed (or at least was mildly amused by the idea someone took the time to do this) the WMP plug-in that made the light keep time with the music being played… A DLL named “Sauron” for a flickering eye-shaped red LED? How DID that one get past the arbiters of taste?
wrote in message news:xxxxx@ntdev… > I am very curious to know how does the 2-way communication happen in case of keyboard. > > What i mean to say is… I have come across a toggle key application which can toggle the numlock, capslock… keys from the application. If the keyboard and mouse are opened exclusively by the operating system, how does this application get the handle to write to the device or even communicate to the device… > > Is it possible to incorporate the similar kind of functionality of glowing light in case of mouse too? if so wat is the way to approach this problem… > > >
If i have the flexibility to change the firmware, will i not be able to glow similar led on the mouse, say an led which is mapped to 2nd or the 3rd button?
I have tried issuing mouse_event() for this purpose and tried to see the logs in the IRP TRACKER, i do not see any activity in the mouseclass driver.
what is the best way to tackle this problem of writing to a mouse device?
I have tried issuing mouse_event() for this purpose and tried to see the logs in
the IRP TRACKER, i do not see any activity in the mouseclass driver.
This can’t work the way you want it to.
Keyboard devices usually have indicator lights, so kbdclass supports changing them if the subsystem requests it (which can be invoked by an application).
Mouse devices usually do not have indicator lights, so mouclass does not support changing “them”.
If you inject a normal keystroke via SendInput, it will be inserted into the subsystem’s internal input queue and successively translated into window messages.
If you inject a lock keystroke via SendInput, it will be inserted, translated and the subsystem will additionally send IOCTL_KEYBOARD_SET_INDICATORS to all keyboard device stacks.
Mouclass only supports IOCTL_MOUSE_QUERY_ATTRIBUTES.
As Bob Kjelgaard already said, look at the firefly example.
By the way, SetKeyboardState cannot change indicator lights, according to Microsoft’s documentation.