Bytech India
asked on
Need to Restrict all types of Manual Entry using Normal/USB/Wireless Keyboard and allow only Scanner
Hi All,
For my C# Win-form application, I have to restrict the manual entry using Keyboard . Only Bar-code scanner should be allowed.
Using below link, I am able to restrict the attached normal Keyboard, But not able to restrict USB or wireless keyboard, as properties of USB Keyboard and scanner are completely same.
https://www.codeproject.com/articles/17123/using-raw-input-from-c-to-handle-multiple-keyboardnow?fid=375378&df=90&mpp=25&sort=Position&view=Normal&spc=Relaxed&fr=226&prof=True
I have also tried restricting keyboard on the basis of speed as typing speed using Keyboard will be slow than scanner but it is completely dependent on client's system speed hence was facing issue on same. Sometimes in few systems, it is restricting Scanner also when I use the speed concept.
Please help me on this.
Thanks.
For my C# Win-form application, I have to restrict the manual entry using Keyboard . Only Bar-code scanner should be allowed.
Using below link, I am able to restrict the attached normal Keyboard, But not able to restrict USB or wireless keyboard, as properties of USB Keyboard and scanner are completely same.
https://www.codeproject.com/articles/17123/using-raw-input-from-c-to-handle-multiple-keyboardnow?fid=375378&df=90&mpp=25&sort=Position&view=Normal&spc=Relaxed&fr=226&prof=True
I have also tried restricting keyboard on the basis of speed as typing speed using Keyboard will be slow than scanner but it is completely dependent on client's system speed hence was facing issue on same. Sometimes in few systems, it is restricting Scanner also when I use the speed concept.
Please help me on this.
Thanks.
You can have a look at https://www.codeproject.com/Articles/18099/A-USB-HID-Component-for-C and https://www.developerfusion.com/article/84338/making-usb-c-friendly/
You may need to investigate how your scanner sends data over the wire. Many scanners simply imitate sending keys like a keyboard would. Therefore, if you block keyboard access, you may inadvertently block the scanner also.
ASKER
Hi kaufmed, Yes same is happening so as of now I am restricting the normal and the USB Scanner based on the hardware properties as shown in the Link in question but there is no difference between the USB Scanner and USB Keyboard properties for which I needed the solution.
You should be able to filter based on HID property.
ASKER
Hi Eduard, I tried same and saw addition of "USB Input device" only whether I add USB keyboard or Scanner. Attached are the images so cant see much difference.
KeyboardLaptop.png
ScannerDesktop.png
ScannerInLaptop.png
KeyboardLaptop.png
ScannerDesktop.png
ScannerInLaptop.png
ASKER
Hello Sir, I checked all these properties, using Hardware id we can differentiate between the hardware but it keeps on changing as we plug out and plug in the hardware.. what can we do for this?
Hi,
I understand that the values are changing, but there is no common part between these string values?
I understand that the values are changing, but there is no common part between these string values?
ASKER
As of now we don't know which company's and which type of scanner partner is going to use, and secondly for scanner and keyboard, any specific part is not coming on basis of which I can differentiate.
Ok, then, in this case, the filtering based on the HID cannot be used that simple. As I'm figuring it out, it will be necessary to have a scanner specific driver installed on the client machine that will facilitate the communication with your application.
ASKER
Well I have made a C# Winform desktop app and any type of scanner can communicate with it with the help of scanner's driver which i think auto installed when we connect the scanner. so I didn't do anything extra for facilitating the communication for specific scanner.
Ok, then there is any API spec on the manufacturer site that can be used to communicate with the scanner device?
ASKER
As partner can use any company's and type of scanner so manufacturer is not fixed..
Have you tried Microsoft Point of Service for .NET v1.14.1 (POS for .NET)?
https://www.microsoft.com/en-us/download/details.aspx?id=55758
https://www.microsoft.com/en-us/download/details.aspx?id=55758
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.