How can I capture a screenshot while the UAC dialog is shown? - java

I am using the Java Robot class to take screenshots, my problem is that in W7 when the UAC dialog is shown (I right click on any application and select run as Admin) it will not appear in the screen shot or the whole screen is just black. Running my application with admin rights or as a service does not solve the problem.
Does any one know what to do so that I will be able to capture the screen even when the UAC is showing?

For security, normal programs cannot interact with the UAC dialog.
You can manually disable that security feature named "Secure Desktop" and instead have the dialog displayed on the normal desktop (so other programs can see it), but this is not recommended. The following explanation is for Vista, but Win7 should work similar: http://www.vistax64.com/tutorials/117448-user-account-control-uac-blacking-out-screen.html

Related

Android- write system settings UI alternative

My Android app currently enables WRITE_SETTINGS in its Manifest. When the app makes an intent Settings.ACTION_MANAGE_WRITE_SETTINGS, it shows a system dialog enabling the user to set the permission for the app to modify system settings. I would like to change this dialog however because I do not like the layout of the system generated screen. In addition, I would like to enable battery optimization on the app as well, and that has its own separate system dialog. The system dialog takes up the whole screen and can be confusing for the user to use, especially when there are two screens displayed in succession.
I would like to use my own XML layout or a popup for the dialog and letting the user enable/disable these permissions as needed. Is there a way to do that and not have the app launch the system dialog?
You can't change the system dialog for settings, media projection, runtime permissions... It's a system dialog, it can't be changed to prevent abuse.
The best you can do is explain to the user what's expected of them before you start showing these system dialogs.
The system dialog [...] can be confusing for the user to use, especially when there are two screens displayed in succession.
Explain what needs to happen before each step.
Explain what you need from the user in your app, in your visual style, then show one system dialog.
After user confirms it explain the next thing in your app, then show another system dialog.
Avast Anti-Theft (not affiliated) uses this approach when setting the app - it needs to enable its device admin and listen for notifications, both are controlled in system UI.

JNativeHook home windows key

I've searched a lot but I didn't find any anwser to my issue.
I recently discovered JNativeHook and I use it to bring to the foreground an application window when I click on a key, even if the application has not the focus. Everything works good when I use keys like "a" or "f" but what I want is to use the "left-home" key of my keyboard.
The problem is when I do that, the windows menu appears but not my application which blinks in orange on the bottom launcher bar.
I think this is a normal behavior since the windows menu has a stronger priority than my application.
Do you think there is a possibility to override the default home button behavior? What I need is to bring to the front my application from elsewhere when I clicked on the left-home button.
Thanks for your replies,
JNativeHook is getting a passive keyboard input from the operating system. If you press the Windows Key, the OS will bring up the menu if it receives that event. If you want to prevent that behavior, you must consume the event before the OS receives it. You can check the Wiki article for unsupported method of consuming events on Windows and OS X.
I've had the same issue with CTRL and similar keys, you just have to run the program using an administrator command prompt (or with sudo-access on Linux)
It won't work if you're using Windows Terminal on Windows 10 though, you have to use CMD, also if you want your end-user to only use the program using administrative privileges, you'd have to add a manifest to your wrapper (You can do that in Launch4J afaik)

How to force java web start to start the splash screen and later window on same display monitor with IE

Scenario: Laptop has multiple monitors, use projector as second monitor.
Bring IE to the projector monitor, type jnlp path to start the java web start, but the Java splash screen (for first time, later time it will show application's splash window) shown on laptop own monitor (first monitor of the system). And so is the later window of the java web start application. I need to manually drag the window but the audience missed the splash window.
Question: is there a way to tell javaws to show Java splash screen, and application splash screen for future to appear on the same display with the browser that started it? Also, how to let the java application to know which display it was on since the user might put IE on any monitor he has?
The JWS splash, unlike the AWT based SplashScreen, does not provide any programmer control. So the answer to your question is 'it cannot be done'.
Answering your question partially, you can change your splash screen through in the JNLP file changing the icon tag attributes.
References.
http://docs.oracle.com/javase/6/docs/technotes/guides/javaws/developersguide/faq.html#206
https://blogs.oracle.com/thejavatutorials/entry/changing_the_java_web_start

Look-and-feel of an applet window changes on subsequent displays

I have an applet that displays a dialog box on click of a button. When the dialog box is first displayed, it is shown using the native look-and-feel of the OS. When the dialog box is displayed a second time (same page, browser, OS, etc.), it is shown using what I think is the Swing look-and-feel. To my knowledege, I do not explicity set the look-and-feel of my applet. Should I be doing so to avoid this inconsistent behavior?
Please elaborate what you mean by "display". A different screen on the same computer? A different computer? Is the same version of Java installed? Is the exact same version of the OS installed?
The user can influence the L&F with environment variables. These docs may help.
Also, for the native Windows XP L&F, you need a special DLL.

Java desktop app: How to maximize tray application when hotkey pressed?

I need to write a program that, when minimized, lives in the System Tray, and I'll use Java 6's SystemTray API to do that.
How can I make that application comes to the foreground when the user presses some hotkey?
For example, the app is running but minimized. When the user presses CTRL-SHIFT-Y or something (or, like Google Desktop's search, CTRL twice) and the application is maximized.
EDIT: I know about how to bring a Java window to the foreground. I'm asking more specifically about how to make a running Java app listen for a hotkey.
You're going to need to resort to JNI, check out an example.
Here's another nice example from Sun's forums.
You can use the following SWT extension library to create a keyboard hook that can listen for your hot key - http://feeling.sourceforge.net/
note, that this is windows only (but that may not be a problem for you).

Categories