I just recently found out about the awt.Robot Library and I'm quite excited to get to use it. I thought I'd play a little prank on my friend and have the robot press control,alt,delete press the lock the computer button but I can't get the program to bring up the control alt delete screen.
Here's my code:
import java.awt.*;
import java.awt.event.KeyEvent;
public class Bot {
public static void main(String[] args)
{
try {
Robot bot = new Robot();
bot.delay(4000);
bot.keyPress(KeyEvent.VK_CONTROL);
bot.delay(100);
bot.keyPress(KeyEvent.VK_ALT);
bot.delay(100);
bot.keyPress(KeyEvent.VK_DELETE);
bot.delay(500);
bot.keyRelease(KeyEvent.VK_CONTROL);
bot.keyRelease(KeyEvent.VK_ALT);
bot.keyRelease(KeyEvent.VK_DELETE);
} catch (AWTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void pressEnter(Robot bot)
{
bot.keyPress(KeyEvent.VK_ENTER);
bot.delay(40);
bot.keyRelease(KeyEvent.VK_ENTER);
}
}