I am working on a Java Non-GUI Client which can capture Global hotkeys in windows OS and perform certain functionalities.
To achieve global hotkeys I have used Jintellitype And I have also worked on JNativeHook as a backup solution, in case something falls in first Library.
Now my requirement says that this should work even on Lock screen & Log-Off screen, as per my understanding an application can run in log-off screen only if it runs as windows service.
For Windows service I have used "Advanced Installer" & followed these steps.
Now when I run my application as windows service, it is not able to take the hotkeys. Same application if I run normally without being windows service it is able to take the hotkeys.
To verify if this is working or not, I am diverting all system.out to a file by following code:
public static PrintStream out;
try {
out = new PrintStream(new FileOutputStream("C:\\"+"output.txt"));
System.setOut(out);
} catch (FileNotFoundException ex) {
System.out.println(ex);
}
Questions:
- M I missing something here?
- Is this requirement not possible with windows?
- Is there any other approach or technology I should use to achieve this?
I'm currently work on similar problem: run own application at logon screen. But, before, let me explain what are the problems. Main problem in "new"(since Vista) windows security model: now all services run in own session and this session have no access to user session (GUI and hotkeys too). System services run at logon - but they can't do anything there. I only found one dangerous solution: use some kind of hook to LogonUI.exe. It can be done via this registry key:
And make copy of LogonUI.exe in system32 folder (LogonUIO.exe). Then this application is get own command line arguments and run LogonUIO.exe with this arguments. This allow to run any program and show any content at logon screen, lock screen, intercept reboot, sleep, logout. But application must be x64 if OS x64.
This is dangerous key - never experiment with it if you don't have system backup or registry/disk access from other OS or this is not VM. I'm already broke few OSs while debugging how to make it works (VMs only).
Right now I make it works stable in Windows 10 and Windows server 2016. In windows 8 this not work yet - I'm debugging it now.
For one problem I'm still not find solution: it have strange command line with some strange numbers:
In windows 7 and Vista same can be done via much simple way - via next registry key:
In windows 10 this will not work.
So, in your case you can try something like this.
Update 1
Found this link with more detailed description of this security model: http://www.coretechnologies.com/WindowsServices/FAQ.html#GUIServices
Update 2
And one more: http://www.codeproject.com/Articles/35773/Subverting-Vista-UAC-in-Both-and-bit-Archite Looks like this can works...