I have 2 USB HID keyboards. They have different VID and PID's.
Now I want, in VB.NET, set up a system global hook when my application starts, so it only "Catch" events from one of the keyboards.
Eg, if I open notepad, and enter things on Keyboard1, with VID 04F3 and PID 0103, I want it to show up in notepad as normal, and my application should ignore the inputs. Best for performance is that my application does not even need to pass on the events.
But if I enter things on Keyboard2, with VID 13BA and PID 0018, I want the inputs from that keyboard to be "sucked up" by my application running as a service. Nothing should show up in notepad. My application will instead react based on the input from Keyboard2.
Any ideas on how this can be accomplished?
You usually can hook the keyboard events by injecting a filter driver upon Kbdclass driver as described in the following link.
http://msdn.microsoft.com/en-us/library/windows/hardware/jj128406(v=vs.85).aspx
The report format is described as KEYBOARD_INPUT_DATA.
If you want only to hook certain USB keyboard, you have to inject the filter driver between HIDclass and HID transport(hidusb.sys). HID transport driver reports the keyboard event in the form of HID input report and it varies among the indivisual keyboard. So it's theoritically possible to hook/block the keyboard inputs by the filter driver which located upon hidusb.sys.
However, you have to know or do reverse-engineering of the format of input reports that the keyboard you're interested reports on every key inputs.
Related
This is my first time posting here. I hope you can help me with this guys.
I am trying to use a Generic RFID USB hardware (R10D-USB)in my VB .Net project.
Problem:
It seems that this RFID-USB hardware looks like it is being read by my computer as a Keyboard device. It is producing Keystrokes.
In Device Manager, it is being known as
Keyboards
----- HID Keyboard Device
also as
Universal Serial Bus Controllers
----- USB Composite Device
Now, whenever I tap an RFID in the RFID Reader. It produces Keystrokes like Keyboard.
It is typing literally as if your typing on your keyboard. So Whenever I tap an RFID to the RFID reader it would write something even in Notepad.
Concern:
What I am looking for is, is there a way I can sort of like assign it to a Port and only works unless it is being read by my VB form.
in other words, it would stop acting like a keyboard and be disabled to all other programs and activities except the program that I will make to catch all of its Keystrokes (can work on background).
I've been playing with a generic usb camera to take snapshots every few seconds. With the help of this SO question, I was able to get the camera working; however, when you click the button to connect to the camera, a dialog box appears.
The difference between the other question and my question is that I have two video sources: a built in webcam and a usb camera. I also intend to have multiple cameras connected, all taking pictures. It appears that when you have multiple devices, you always get the dialog box where you have to choose the device. I'm trying to automatically choose the camera (and eventually cameras, plural) without this dialog box.
There are other pieces of sample code that I have played with - samples that have a device listbox that is populated; I thought this was what I needed (and I'd just remove the listbox control and process the list and what to connect to in code), but every one of these samples populates the listbox with "Microsoft WDM Image Capture (Win32)" instead of the devices listed in the dialog after attempting to connect to this "device."
Surely there's a way to automate the webcam(s) I'm connecting to instead of having to choose it from a dropdown in a Windows dialog, right? How would I go about doing this?
The solution ultimately was to use EMGU to access the camera; this also allows for connecting to multiple cameras at the same time.
Is it possible programatically change keyboard input anywhere , when the program is in tray?
Example.
When user type text in, say, Google Chrome then my program catch the key the user types, and change it to another symbol (in another language)?
A -> ❤
B -> 웃
C -> ✄
etc.
Is it possible? and if answer is YES, then how?
This sounds like a job for a custom keyboard layout.
After installing your keyboard layout, the user need only enable it in the “Language & Text” preference pane and then select it in the Input menu extra.
It's also possible to enable and select an input source (keyboard layouts being a kind of input source) programmatically.
You can do this a number of ways.
You could capture NSEvent key events and change them.
You could override keyDown: in your own view subclass.
And more.
Read up on the Cocoa Text System first
https://developer.apple.com/library/mac/documentation/TextFonts/Conceptual/CocoaTextArchitecture/Introduction/Introduction.html
You can use Quartz event taps to receive all key events first and modify them before allowing them to be processed (or substitute different events entirely). Note that the user will have to enable access by assistive devices in Universal Access preferences in order for event taps to see keyboard events.
You could create, install, and have the user select a custom keyboard layout. You can use the third-party Ukelele program to create and modify keyboard layouts. This doesn't involve code, necessarily. It's just a big state machine for translating key codes to characters.
You can probably accomplish something like this by implementing an input method, too. See the Input Method Kit.
I have a USB bar code scanner that is acting as an HID keyboard emulation device. I want a web page that, for testing purposes, pops up a JavaScript alert when a scan is done. I don't want to tie the event to any visible control such as a textbox so thus, I won't have focus on any control to capture the scan input. Can this be done? I'm using VS 2010 with .NET 4.0 and VB.NET with a Symbol USB bar code scanner. Thanks ... Bob
Different bar code scanners can output different control characters like tab and line feeds. You should read the manual for your scanner.
You should be able to pick those up with a key press event handler.
We have a hardware device, with an LCD display. It supports an USB interface to connect keyboard and mose. Using these keyboard and mouse, we can navigate to varios menu items and edit entries.
We have couple of test cases written to verify that mouse click and keyboard input events are working when pressed respective key.
My task is to automate these test cases.
I donot have any control to the hardware device, as I can not access the o/s kernel or any application running there. There is one way to verify what is currently displayed on the UI. So I have to use that and verify whether the mouse/keyboard has performed the appropriate events.
As I have gone through couple of previous posts, it seems like that one of the way to achieve this is through virual HID device driver rather than actual keyboard and mosue. But I am not sure how to achieve it.
Please do help me for it. I am fine with any programming language.
I am more interested to simulate the mouse and keyboard events.
You probably don't need to write your own driver. AutoHotKey does pretty much anything you can think of, and the scripting language is quite easy to learn.
You can get it here:
http://www.autohotkey.com/
Since you're using linux, here's a similar project that will run on linux:
http://sikuli.org/