Get keyboard keyPress in windows service (vb) - vb.net

I am working on a windows service application that required to get the barcode reader characters and saving the value in database, I have tried some methods like this one:
http://www.codeproject.com/Articles/7294/Processing-Global-Mouse-and-Keyboard-Hooks-in-C
But they not working in the windows service app, does anyone knows how can I get the keyboard/barcode reader characters in the windows service?
Appreciate the help in advance,
Regards,

As already mentioned you can't get access to the keyboard and screen from a windows service in Windows platforms starting from Vista (the interact with desktop setting is no longer supported)
So you are better off just writing a standard application that launches when a user logs into the workstation.
Since most barcode readers function like keyboards your other problem will be determining when a barcode has been entered as opposed to normal keyboard activity. Either using some kind of attention sequence (like clicking on a tray icon) or timing the speed of characters (barcode characters will appear to be "typed" very quickly)
Your global keyboard hook will work just fine from a user-mode application too :-)
Happy coding

Related

App modeller, Identify button not showing up in blueprism spying

I am creating calculator VBO in blueprism object studio.
In application modeller I gave calc.exe path and able to launch calculator, but I am not getting identify option to spy on any element..
In Element, After clicking Launch buttion, identify is appearing for a split of sec and Launch button is coming back instead of Identify
PS- As mentioned in videos and links, I have launched calc via application modeller not directly via windows..
I am using windows 10, BluePrism V.5.0.11.0 versionenter image description here
Windows 10 calculator is complicated case, please consider using different application in your training. For example paint is much simpler to get started.
If you really need to get that going, then you may need to launch application first, using one object, and afterwards use second object to attach and interact with it.
can be two reasons
1. Either your application is not launched properly.
2. Sometimes we face problems with some versions of applications.
The best way to fix your problem is
Edit your settings remove the application path from the navigate stage.
Launch the application separately
Open Navigate stage > Action > Attach
Provide the window title within quotes (example: "Calculator")
Click OK then run the object
Now if you go to application modeller
You will be able to see the identify button under the element.
Hope this will help you.
I resolved this by unchecking "Disable invasive techniques (hooking)".
The Windows 10 calculator runs with process name win32calc which is also located under c:\windows\system32.
So when you launch the application please make you identify the applications process name and its location
I resolved this by circumventing to windows 7 calculator instead of a windows 10 calculator on windows 10.
Link to download win 7 calculator for win 10-
https://winaero.com/download.php?view.1795
This will be installed in the same place as your default calculator.
Inside-
C:\Windows\System32
The name of the app in my case was "calc1.exe" to avoid collisions with the default calculator.
I used this as my base reference app for spying and it worked.
Also note, the hover to highlight button seems to be a bit buggy, try a bit hit and trail to get you required button to be highlighted and mark using "Ctrl+LeftClick"

Oracle MAF: Clicking on Input text fields in a dialogue popups causing random crashes under Windows 10 Anniversary Edition

We have implemented a tablet-based application using Oracle MAF. The application runs on Windows UWP. When it was rolled out last year, it has been working fine until the customers upgraded Windows UWP on their laptops to Windows Anniversary edition. After some investigation, We found the following issues:
When user clicks on input text fields in a popup dialogue, the
application randomly crashes (not always but frequently).
When user clicks on input text fields in a normal window (i.e. not in a popup dialogue), and if the screen resolution is scaled (e.g. 150%), the
application also randomly crashes.
When screen resolution is not scaled (i.e. 100%), clicking on input text fields in a normal window
does not seem to cause crash. However, clicking on input text fields
in a popup dialogue can still cause crash.
We could not find any useful/relevant info in Windows log or in our application log.
We have also tested our application with the latest Windows Creator Edition and MAF 2.4.1, we found that the chances of random crashing seemed to have decreased, but crashing could still happen.
We have checked the Oracle MAF certification information at http://www.oracle.com/technetwork/developer-tools/maf/documentation/maf241certmatrix-3746359.html.
It states that "Any tablet or desktop running Windows 10 with Intel processor" are supported. Our customers' laptop specs are:
Lenovo Yoga with Intel Core i5 processor;
Windows 10 Anniversary Edition;
Full High Resolution screen (1920x1080)
Therefore, we believe the customer laptops provide certified runtime environment for MAF applications.
We have researched various technical forums. There seems to be little information about using MAF under Windows UWP environment.
Because our application has been used in production, and the customer corporate mandate is to use Windows 10 Anniversary edition, the customer expressed grave concerns to us for choosing MAF as the mobile platform technology, and we are now under enormous pressure to fix this issue. Any suggestions and pointers will be highly appreciated.
If you can create a reusable test case, my recommendation to you is to lodge a Service Request with Oracle Support so Oracle's development teams can look at this.
We have done further investigation on the issue "input text field causing crash on Windows 10 Anniversary Edition". This time we used the demo CompGallery application from Oracle. We navigated to the "text box" tab, clicked on the text box in "outside a form", entered some text, then clicked on "inside a form" text box. The application crashed (or repeat the above sequence a couple of times on Windows Creator Edition, the application would crash). Note by using "tab" key or screen tapping to navigate between input text fields, we can avoid crashing. With extra clicks on different input text fields before entering text, we can avoid crashing as well.
The CompGallery screen is shown below:
We then looked at the Windows log, not much details were revealed. It contains an event related to the failure of edgethtml.dll, as shown in the screenshot below.

How can i keep focus on my own application or regain it when lost in delphi? [duplicate]

I need to create a simple Delphi application, kiosk style.
It is a very simple thing, a single form where the user writes some personal info to register to an event. 4 TEdit and a TButton.
What I want to achieve is to avoid the user does any action different then typing in TEdit or clicking on the TButton. For example I don't want he does ALT TAB (switchin applications), pressing windows key on keyboard, doing ctrl-alt-canc, etc...
I can add a passowrd protected Button that enables/disables this "Kiosk mode", in this way as I need to exit the kiosk mode I simply press that button and exit.
How to achieve this "kiosk mode" in Delphi without intercepting all the keystrokes manually? Or did anyone already develop this so it can be shared?
I think you'd better create a new desktop, and run your app in there. When your app is done, you can bring back user's desktop. That is how Windows login screen works. Of course Windows login screen uses a special secure desktop. Your app in a separate desktop would be isolated. You will have a desktop background with no start menu, taskbar, or desktop icons because explorer.exe is not running there automatically. Of course a can start a new process, using Task Manager, but desktops in Windows are securable objects; therefore, you can make restrictions if you want. Of course if your app has sufficient permissions.
To create a new desktop, you can use CreateDesktop Windows API, and to switch to the newly created desktop, you can use OpenDesktop function.
You can try Change the Windows Shell.
When you start windows, you don't execute the default shell (explorer.exe), you can execute your application.
Al internet you can find alternative Shell (more attractive) to default windows like:
BlueBox or
SharpE
This option is used for purposes similars at the application that you are developing. Kiosks or TPV.
For change the default applicacion you must modify a registry key:
In Win3.x and Win9x, SYSTEM.INI file:
[boot]
shell=MiAplicacion.exe
In Win2k and WinXP, use Registry:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
Shell=MiAplicacion.exe
If you test this option, think the mode to turn the configuration to the original value (button or option). You must reboot to test changes.
ADDED: In addition, if you search on the web some similar at this "Delphi Change default windows shell", you can find more code, samples and information about this.
Regards
P.D: Excuse me for mistakes with english.
Well but if someone can open the taskmgr he could just create a new task and run explorer.exe from there so its not really secure though...
Ok Taskmgr can be stopped with policies...
Well and for disabling the cad sequence you can use saslibex which Remko Weijnen had created you can find it here: SASLibEx
kindest regrads,
s!

Windows 8 .net focus issue form.activate has different behaviour when running with debugger

I have written a WinForms driver safety application for a windows tablet device that will blank the screen (display a full screen blank topmost window) when it detects that the car is moving at say more that 15km/h (using the tablets GPS).
The software has worked fine under Windows 7 but I'm struggling a bit to get it working under Windows 8. My first challenge is to display the blank screen when the Metro start menu is currently displayed. So if the user has the Metro start menu displayed and the car starts moving > 15 km/h my blank screen should display... I need to steal the focus from the metro interface and display my blank window on the desktop.
To test this I wrote a simple vb.net app in 2010. It had a form with a timer firing every 3 seconds. In the Tick event I had the code:
Beep()
Me.Activate()
When I ran this with the debugger and pressed the windows key to show the Metro Start Menu, it worked... The focus switched back to the desktop (and my window). However, when I ran this without the debugger and did the same thing I could hear the beeps but the focus never switched back to the desktop.
Any ideas why the behaviour would be different? Any ideas on how I replicate the same behaviour I get when the debugger is attached?
I have tried a few things like AppActivate, setting the form TopMost, BringToFront but unfortunately this hasn't worked.
The only half solution I have come up with is to send a windows button keystroke but this has other issues.
Windows specifically tries to prevent applications from stealing the foreground from other apps. See the SetForegroundWindow documentation for commentary on this and the factors that can let an application come to the foreground (all of the methods you are trying essentially come down to a SetForegroundWindow call).
Note that one of the explicit blocking circumstances is "The foreground process is not a Modern Application or the Start Screen."
This works for you when debugging because "The process is being debugged" is one of the cases which explicitly allows foreground privileges.
Because this is a generally user-unfriendly thing to do there isn't a good general purpose way to bypass this behaviour and steal the foreground.
Likewise, normal apps cannot run on top of Modern applications or the start screen.
You may be better off locking the system by calling the LockWorkStation function.

How to disable the CTRL key in vb.net

I have written a program for work that kills windows explorer (effectively hides desktop icons, taskbar and start menu) so no users can access the internet from our machines, this works well as most machines are touch screen so no keys can be pressed and no access to OSK, but to go a step further I am needing to disable the CTRL key when explorer is not running (Killed in my program) then enable it when they are back (Active in my program).
I've searched Google and seen a lot of ideas but none seems to work, i've got a timer that kills task manager if it starts up, the reason i need to stop CTRL is incase a keyboard is present on the machine i need to stop any shortcuts from being activated and they mostly seem to use the CTRL key.
I know they might be other short cuts but the guys who use my machines aren't the brightest bunch of people in the world but they might be one that 'is reight good ont tinternet'.
Cheers for any advice
Mark
You should look into Kiosk mode.
Here is an example of enabling it in Windows 8.1:
Enable Kiosk Mode in Windows 8.1
If you are still using Windows 7, there are workarounds, like this one:
Creating a Kiosk Machine with Windows 7 and Two Free Applications