I'm trying to minimize all open applications, and using the following code:
public class Test {
public static void main(String args[]) throws Exception{
Runtime.getRuntime().exec
(new String[] {
"cmd.exe",
"/c",
"\"" + System.getenv("APPDATA") +
"\\Microsoft\\Internet Explorer\\Quick Launch\\Show Desktop.scf" + "\""
});
}
}
When I run the code, nothing happens.
I'm using Windows 7, when I open Internet Explorer the PC crash from some virus reason (maybe there is a connection?)
Here is a way to show the desktop, using the Java's Robot class.
This class simulates mouse and keyboard inputs.
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_WINDOWS);
robot.keyPress(KeyEvent.VK_D);
robot.keyRelease(KeyEvent.VK_D);
robot.keyRelease(KeyEvent.VK_WINDOWS);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With