Searching found many answers along the lines of it depends on the device driver", but I don't think that it's that way here.
I have a cheap & nasty RFID tag reader. You just have to open notepad, touch a tag to the read and its serial number appears in notepad (I have not tried it in Linux).
Anyhoo, how can I programatically capture this serial number in VB.net (20088 express)?
Seem it work in keyboard emulation.
You can try to create a simple form with a textbox and check if the serial number appears on it when the tag is read and then manage the textbox events to retrive the info and set the focus correctly.
This probably works using keyboard emulation. The reader is pretending (to the PC) to be a USB keyboard, and simply sending the keystrokes.
If so you could do various things to check the keyboard input in VB.net. For a quick-and-dirty test, I would simply create a blank form with a textbox, make sure the textbox has focus, and read a tag. If the text passes to the textbox then the RFID reader is just passing keystrokes in, and you can use the textbox events to read the data (remembering to set focus to the textbox when you expect input).
If your app needs to do something more sophisticated with the input keystrokes, or you don't want them appearing in the control, you can trap and handle the keystrokes as they happen - the standard KB article on how to do this is here: http://support.microsoft.com/kb/320583
Related
I have a barcode scanner. Each time this barcode scanner scanns something it first types ##1 and then the code it has read. I would like my app to set focus to a specific textbox whenever it detects the sequence ##1 regardless of what is selected/active when i am scanning. (for instance the focus could be on the form itself, or on an image, or in a table or whatever..)
The only way I have found is to use a global keyhook using getasynckeystate but its not good practice since most antivirus programs see it as a keylogger. I also do not need them to be detected when the program is not in focus.. only when in focus. Is there a proper way to detect all the Keys pressed while the application is active, that does not upset the antivirus programs?
I want to create a Winform that assists me in typing Old English characters. Some of them I can access using the US International Keyboard, but there are some that I can't and don't have working Alt-Codes on Windows, like characters with macrons (āēīōū), ash with macron (ǣ) and characters with dots above (ċ and ġ). (If you do know an easier non-programmatic way to do this, much obliged if you let me know.)
So I want to create a program which I can open and then run, and allows me to do two things:
When I have a textbox selected in any program (Chrome, Word, Notepad etc.) I can press a button on my program without losing focus, and generate the character associated with that button in the relevant program. (Essentially I want to replicate the Windows On-screen keyboard with a specific subset of characters)
When I have a textbox selected in any program, I can press a specific key-combination (e.g. Alt-C or RightAlt-G) that would generate the special character in the textbox.
I'm struggling with both steps, so I'll start with the first one. How can I print a character in another program on pressing a button (I couldn't find this by Googling,) and how can I keep the focus on the program I'm in, to ensure that when I press the button, my program doesn't become focused?
Here's my form layout:
I'm using VB.NET and Windows Visual Studio 2015.
The overall goal is to be able to access a pop-up keyboard through an application that I am making in MFC.
I have created a dialog box with an empty text field. I would like to be able to click the empty field and have an onscreen keyboard to enter in the data field.
Is there list of functions or tutorials that anyone can provide me with to be able to perform this function? Ultimate I will be making the keyboard from scratch, so any guidance would be useful.
My first thoughts (I might be wrong someone might correct me if i am wrong.)
1)Create your Keyboard Ui in an MFC DLL and export the KeyBoard Functions like LaunchKB(Int screenx,int screeny) and CloseKB()
functions.
2)I would subClass CEdit and CRichedit such that when the edit control gains or loses focus it would call LaunchKB() function with windows ScreenX coordinates where the keyboard has to be displayed or CloseKB().
3) A callback function registered to dll ,which would get called for every click on the keyboard with characters clicked and these characters are to be displayed in the edit control.
This is just my thought ,there may be better ways to implement as well.
I'm developing a VB.net windows application and I have some issues with the keyboard input.
My application has different forms and I'm showing and hidding them with the user interaction. One of the inputs comes from the keyboard, and here is where I have a problem.
When I hide a form and show the next one, most of the times the new-shown form does not receive the keyboard input until I click somewhere on it.
I assume that the problem is that the new form I'm showing is not the "selected application" for windows until the user interacts with it by clicking on it, but I don't know how to set this "property" by code.
I tried with focus and select on the whole form (Me.select/focus) and in some form's control (me.lbl_xxx.select/focus), but I did not get any result.
Can anyone explain me how to control which application/form gets the keyboard input on windows?
Thanks
David
You can't really interact with a label so the input focus won't be set properly.
Focussing a specific textbox on your form on the other hand should just work fine.
I have an ActiveX DLL which currently reads from a serial port. Now I want it to accept input from a USB device.
The USB device functions as a standard Human Interface Device. That is to say, if I open Notepad then the device's output will appear in Notepad as if it were typed on a keyboard.
Normally, I would capture Key Up/Down events, but I think that I need a form for that and my DLL does not have a form.
How can I capture that input?
[Update] I found this http://us.generation-nt.com/answer/anyone-know-how-read-keyboard-input-within-an-activex-dll-help-7934442.html# which claims to do it, but the code there won't work as is uses the AddressOf operator, which can only be used in a .BAS file, so not in an DLL .CLS
I am not even sure if I am looking for a system wide hook or application specific.
Hmmm, http://www.xtremevbtalk.com/showthread.php?t=77216 says "You can't implement a global WH_KEYBOARD hook in VB - it requires a standard (non ActiveX dll) as it has to be loaded into the address space of all the running applications."
[Upper date] So, maybe I can a form, make it 1x1 pixel and invisible and have a function GetTheData which shows the form modally and collects and returns the data - either getting keyboard input at form level or into a (n invisible) control then closes the form returning the input.
Would that work? If anyone posts a working example I will award a bounty (I would prefer that the form not be visible on the task bar and have no close button; the user should not be aware of it, or able to close it, it should close itself when it receives enough input from the USB attached HDI).
You can use RegisterRawInputDevices to monitor HID devices' input but this requires a window to listen for WM_INPUT message which means subclassing the window.
Here is a working sample project: UsbBarcodeSanner.zip
I think you have better option,
using uesr32.dll you can do this task easily,
refer this link
you will be able to use this function
Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer
This dll handles anything you want for user in windows.. refer Old Post
I hope this will help..