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.
Related
I'm developing an application in which, if I press a combination of keys shows me a popup inside the form of another external application, I mean something like the "windows game menu", but I have no idea how to show the popup in the external application. I leave you an image to make you understand what I mean as a popup. sorry for my english but I do not speak.
Thanks in advance
You cannot control one application form of another application without having access to its code or knowing if a queue messaging command has been set for doing it.
It is possible to program a window of your application to be shown over any other , likely this will not be working over a Directx - OpenGL full-area, i.e. when you are playing a videogame that is using the same functionality because the last one is winning.
In this case your popup will be visible barely as a flick, but considering standard form application you can make it to stand over by working with userd32.dll method
"SetWindowPos" with the flag HWND_TOPMOST.
You will need first to detect the position of the application window, or if it is a fullscreen one you can simply detect the size of the screen and consider to place it in the center, then you can set the position of your application form "pop-up".
Details about the SetWindowPos , which is among windwows base dll but can be invoked from .net here below:
https://learn.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setwindowpos
Make a window topmost using a window handle
I'm dealing with a barcode scanner that acts as a keyboard emulation.
I print my barcode labels with a custom heading character (pipe) .
In my main form, I listen to the keypress event and as soon as I see the custom header character, I start receiving the scan and than do my stuffs.
This method works pretty well if my application is focused but can't do nothing if the application is minimized or unfocused.
I tried to setup a keyboard hotkey. It partialli works: my application get focused on the first character but is not fast enought to capture the subsequent characters spitted very fast from the scanner.
Any idea on how to capture this keystrokes with the application unfocused?
Obviously if the heading char id detected the subsequent characters must be suppressed until the sequence is completed with a vbcr or a timeout is reached.
Note that the scanner spits a sequence of 15 characters in less than a tenth of a second
This is how Windows works, only the active application will handle keyboard input. Thus, when your application is minimized, it will not receive or handle any keyboard input.
As Bradley Uffner commented, you need a global keyboard handler, I've used this in the past and it works quite well. Basically a system wide listener that will handle keyboard input even while minimized.
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.
I'm developing a Windows Store app for an embedded application where the only input device is a small touchscreen. For this reason I'm developing my own number and text entry controls that match the visual look of the application and work better on the small screen. Is it possible to prevent the Windows 8 on-screen keyboard from appearing when a textbox gets focus?
You can't, it's a user preference as of now.
Similar question is found here
From Hanselman
Unfortunately there is no checkbox or "just turn it off" way to
disable the keyboard with a supported option.
However, there is a way to effectively disable the keyboard by
stopping the service that controls it.
Press the Windows key + W Type "services," and press Enter Scroll down
to "Touch screen keyboard and handwriting panel" You can either right
click and "Stop" or you can double-click and change it from
"Automatic" startup to "Manual."
i know my question seems very similar to others according to a buffer-clear issue... but here is a detailed description:
I have an motorolla handheld (bar-code scanner) which is reading barcodes over an tray tool.
The code is scanned by the traytool und is casted as an keystroke like a normal press on a key on a keyboard.
so i have an app in vb which should read a barcode and after that a second and than proceed the inputs.
after reading 12 chars/numbers my textfield should set the focus to an other textfield (2. barcode) so i check onChange the length and than set the focus to the next textfield.
if there is a malicous barcode or a barcode which contains more than 12 characters/numbers the second textfield will be filled with all chars after the 12. char from textfield 1.
i have no control over the scan behaviour or the keydown event of the scanner trigger... nothing possible.
also there is no termination symbol in the input data which signals me that one block is ending here.
so how is it possible to clear the buffer of the virtual keyboard of the scanner ?!
any suggestions?
I suggest downloading the manual for your scanner to find the configuration codes. They are typically a set of special barcodes that can be scanned to set properties such as allowed symbologies. What you will want to do is set the scanner so that it appends a CRLF, Tab, or other terminator for your data. That way you can act upon the end of the barcode.
You can use TWAIN to handle the scanning thought i am not sure whether it supports Motorola. Try to download some TWAIN libraries and in-cooperate them with your project.